00:03:55 | tk | I present: https://github.com/nim-lang/Nim/issues/19153 - the weird bug I found |
00:04:08 | tk | if someone can come up with a better issue title, that would be great. |
00:06:18 | tk | hmm, adding more type annotations fixes it |
00:06:21 | tk | interesting |
00:09:09 | FromDiscord | <Elegantbeef> `iterator` and `proc` are type classes so that's probably the issue |
00:09:18 | FromDiscord | <Elegantbeef> It doesnt fill them in and it errors due to it |
00:09:56 | FromDiscord | <Elegantbeef> It should be `iterator(): int` and `proc f(): iterator(): int` |
00:10:59 | tk | ah, I think I found another weird bug, but this one doesn't crash the compiler, let me show you and you can tell me what you think ... |
00:13:08 | tk | Elegantbeef: http://ix.io/3F6N this prints <> and crashes (because there is no such file) |
00:13:20 | tk | I assume filename should be getting captured there but isn't |
00:13:39 | tk | if you put the entire iterator INSIDE the func you get what I wanted to begin with |
00:17:41 | tk | (which I think may be what as_closure does but I didn't investigate it) |
00:18:19 | FromDiscord | <Elegantbeef> Yea that's pretty much what it does afaict |
00:18:19 | FromDiscord | <brainproxy> I've started using nimlsp with Emacs, very nice experience so far! One thing I noticed is that nimlsp doesn't seem to honor `nim.cfg` in current/parent directories. Is that a known thing? |
00:19:00 | FromDiscord | <brainproxy> (edit) "current/parent" => "a source's directory / its parent" |
00:24:40 | tk | https://play.nim-lang.org/#ix=3F6Q - here's a concise example |
00:30:16 | * | Jjp137 quit (Quit: Leaving) |
00:52:13 | * | krux02_ quit (Remote host closed the connection) |
00:53:08 | * | sagax joined #nim |
01:07:49 | * | Jjp137 joined #nim |
01:13:21 | FromDiscord | <d-static> Any books for nim? |
01:17:19 | * | audiophile_ joined #nim |
01:18:52 | FromDiscord | <Elegantbeef> There is "nim in action" and http://ssalewski.de/nimprogramming.html though the latter isnt a published book |
01:36:32 | FromDiscord | <evoalg> There's a sale on for this book at the moment: https://www.manning.com/books/nim-in-action |
01:53:17 | * | Guest36 joined #nim |
01:53:42 | * | Guest36 quit (Client Quit) |
02:08:15 | NimEventer | New post on r/nim by vanyle_: A Nim plugin for Sublime Text, see https://reddit.com/r/nim/comments/quwoar/a_nim_plugin_for_sublime_text/ |
02:28:58 | FromDiscord | <evoalg> Coming form python, as I'm getting used to Nim's typed variables, maybe I'm now transitioning from cursing them to liking them ... one of my proc's returns a string, but I was trying to assign it to an int variable, and the nvim plugin changed the color catching it immediately, which meant I noticed the bug straight away. Might have taken me ages of debugging in python. |
02:29:35 | FromDiscord | <Elegantbeef> Yep static typing is fantastic |
02:30:51 | FromDiscord | <evoalg> I'm impressed that I didn't even need to compile it to catch the error |
02:31:24 | FromDiscord | <Elegantbeef> Well it 'compiled' đ |
02:32:09 | FromDiscord | <evoalg> the nvim syntax highlighting changed straight away though, it wasn't compiling it right? |
02:32:34 | FromDiscord | <Elegantbeef> Well the file is semantically checked so somewhat compiled |
02:32:59 | FromDiscord | <evoalg> ah I see what you mean |
02:33:00 | FromDiscord | <Elegantbeef> It's like a super lazy compile, no code is generated but it's semantically analysed which is like half of compiling |
02:48:31 | FromDiscord | <evoalg> Why would a stream be used on a string instead of using a for loop? I'm trying to understand what the std streams module is good for, as I saw some code where it was used on a string. |
02:49:26 | FromDiscord | <Elegantbeef> steams only loads a segment into memory at once, so it's more memory efficient, and for large files the only way to do it |
02:49:55 | FromDiscord | <Elegantbeef> If you have a 30gb file and 3gb of ram you're not going to be able to read the entire file, so you want to stream it in, process it and stream it out |
02:50:11 | FromDiscord | <evoalg> true! |
02:50:41 | FromDiscord | <Elegantbeef> There is the caveat of "your swap might be large enough" but if you want performance you've lost the battle |
02:50:55 | FromDiscord | <evoalg> makes sense |
02:52:38 | FromDiscord | <evoalg> but what about doing `for line in "myBigFile.txt".lines:` ? is that mem efficient? |
02:53:52 | FromDiscord | <Elegantbeef> It seems to read each line to a string and yields it so probably |
02:54:01 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/io.nim#L901 the source button lets you see all manner of fun |
02:54:32 | FromDiscord | <evoalg> ah thank you! |
02:56:17 | * | neurocyte0132889 quit (Ping timeout: 250 seconds) |
03:02:32 | * | rockcavera joined #nim |
03:02:32 | * | rockcavera quit (Changing host) |
03:02:32 | * | rockcavera joined #nim |
03:21:51 | * | joshbaptiste joined #nim |
03:38:41 | * | arkurious quit (Quit: Leaving) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:33 | * | supakeen joined #nim |
04:07:01 | * | xet7 quit (Remote host closed the connection) |
04:07:02 | FromDiscord | <brainproxy> sent a long message, see http://ix.io/3F7r |
04:07:58 | * | xet7 joined #nim |
04:09:44 | FromDiscord | <Elegantbeef> I dont think there is a drop down, but yea this has been a thing for a while |
04:11:48 | FromDiscord | <brainproxy> đ€Šââïž |
05:42:01 | * | audiophile_ quit (Quit: Default Quit Message) |
06:10:01 | FromDiscord | <evoalg> Maybe the way I'm doing this the best way, maybe not ... it took me the longest time to get the table I wanted: https://play.nim-lang.org/#ix=3F7P ... I'm so slow |
06:28:32 | * | joshbaptiste quit (Ping timeout: 265 seconds) |
06:30:03 | * | joshbaptiste joined #nim |
07:16:08 | * | rlp10 joined #nim |
07:51:28 | FromDiscord | <Rika> Naively replacing " might be wrong depending on use case |
08:03:44 | * | tiorock joined #nim |
08:03:45 | * | tiorock quit (Changing host) |
08:03:45 | * | tiorock joined #nim |
08:03:45 | * | rockcavera is now known as Guest2078 |
08:03:45 | * | Guest2078 quit (Killed (strontium.libera.chat (Nickname regained by services))) |
08:03:45 | * | tiorock is now known as rockcavera |
08:23:11 | * | joshbaptiste quit (Ping timeout: 264 seconds) |
08:29:55 | * | joshbaptiste joined #nim |
08:48:21 | * | neurocyte0132889 joined #nim |
08:48:21 | * | neurocyte0132889 quit (Changing host) |
08:48:21 | * | neurocyte0132889 joined #nim |
08:56:00 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8c |
09:00:21 | FromDiscord | <Rika> What do you mean |
09:01:05 | FromDiscord | <Rika> Also I donât know why youâre returning a proc either |
09:05:15 | FromDiscord | <Zoom> I mean I'd like to take `f` outside of the parent proc.â”And what should I return in your opinion?â”(@Rika) |
09:05:38 | FromDiscord | <Rika> I mean I donât know what reasons youâre doing certain things for |
09:06:14 | FromDiscord | <Rika> If you want to somehow modify f then the proc should instead be a macro or whatever, I would be led to believe |
09:09:02 | FromDiscord | <Zoom> `f` is a regular procedure, it can take arguments, why use macro? |
09:14:59 | FromDiscord | <Rika> Iâm not sure what you mean itâs probably just an understanding issue |
09:15:08 | FromDiscord | <Rika> If you just want to add an argument then thatâs all you need to do |
09:15:37 | FromDiscord | <Rika> Add an argument to f (and the return type) and then now when you call the factory the returned proc will need an argument as well |
09:16:38 | * | PMunch joined #nim |
09:23:54 | FromDiscord | <Zoom> Well, thank you very much, this helps a lot. I would never have come to this solution without you.â”(@Rika) |
09:24:29 | FromDiscord | <Rika> If youâre being sarcastic then I do not know what you mean |
09:24:37 | FromDiscord | <Rika> And you are not helping |
09:24:57 | FromDiscord | <Rika> So feel free to ask again once you want to help |
09:25:59 | FromDiscord | <Zoom> Do you want me to walk you through the code in question? What is it you don't understand? |
09:26:29 | FromDiscord | <Rika> I donât care |
09:27:15 | PMunch | @Zoom, had a look through the log and I'm not entirely certain what you want to do either |
09:27:24 | FromDiscord | <Zoom> I return a proc because this is what the parent proc does\: returns procedures. If it returned iterators Nim would treat the results as iters, leading to errors such as\:â”` type mismatch: got <int>` |
09:27:36 | FromDiscord | <Rika> No shit |
09:27:52 | PMunch | @Rika, no need for that.. |
09:28:07 | FromDiscord | <Elegantbeef> Well the confrontation either way is less than needed |
09:28:10 | FromDiscord | <Rika> I canât be nice to some fuckhead who thinks I can read minds |
09:28:21 | FromDiscord | <Zoom> If it's so clear to you, why did you ask me why a few minutes ago?â”(@Rika) |
09:28:26 | PMunch | @Rika, again, no need for language like that |
09:28:40 | FromDiscord | <Elegantbeef> Eh to be fair pmunch zoom was very sarcastic |
09:28:51 | FromDiscord | <Elegantbeef> Both need to go sit in time out and think about what they did |
09:29:09 | FromDiscord | <Rika> You help him |
09:29:10 | PMunch | True, but just because someone else is rude doesn't mean you have to |
09:29:19 | PMunch | I'm trying.. |
09:29:32 | FromDiscord | <Rika> Of course but itâs not realistic to take everything every time |
09:29:39 | FromDiscord | <Rika> Thereâs gonna be a limit to each person |
09:29:49 | FromDiscord | <Schelz> Cry ? |
09:30:08 | FromDiscord | <Rika> What do you mean now |
09:30:21 | PMunch | But instead of being rude back just go do something else *shrugs* |
09:30:33 | FromDiscord | <Elegantbeef> I swear if the next comment isnt about the problem at hand i'll finally snap! |
09:30:38 | PMunch | Anyway @Zoom, what are you trying to do |
09:30:55 | PMunch | You have a procedure that returns a procedure which returns an iterator |
09:31:24 | PMunch | But your procedure is called iterFactory, so why not just return an iter+ |
09:31:32 | PMunch | ?* |
09:31:46 | FromDiscord | <Rika> Perhaps some other code takes in the proc that returns an iterator |
09:31:49 | FromDiscord | <Zoom> I don't like being talked in a condescending manner when a person ignores the question you ask and dismisses the issue because they don't understand the intent. |
09:31:56 | FromDiscord | <Rika> And the factory is just adhoc uh |
09:31:59 | FromDiscord | <Rika> Whatâs it called |
09:32:07 | PMunch | No one does, but lets get back to your problem |
09:32:15 | FromDiscord | <Rika> I donât know the think they do with functions in Haskell |
09:32:19 | FromDiscord | <Elegantbeef> The pissing contest is very much not needed |
09:32:20 | FromDiscord | <Rika> Partial functions something something |
09:33:02 | FromDiscord | <Zoom> Because it either doesn't work or I don't know how to do it (notate the types probably) properly.â”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
09:33:07 | FromDiscord | <Rika> Well what now, do you want help or do you want to continue shitting on me |
09:33:38 | FromDiscord | <Rika> We donât know what your whole code is so we canât infer what you want exactly |
09:34:41 | PMunch | @Zoom, but what are you actually trying to do? |
09:35:08 | PMunch | @Rika, again with the harsh language. Please try to keep it civil |
09:35:14 | FromDiscord | <Zoom> No one shitted on you, look through the log. I'd like you to ignore the questions you're not interested in or those coming from people with deficiencies, whom I am, according to your evaluation.â”(@Rika) |
09:35:30 | FromDiscord | <Rika> What now? I didnât call him anything, Iâm asking if he wants to keep on being rude to me |
09:35:38 | PMunch | And @Zoom, stop engaging with him and tell me what you're trying to achieve so I can actually help you.. |
09:35:43 | FromDiscord | <Elegantbeef> The easiest solution is to just drop it |
09:35:52 | FromDiscord | <Elegantbeef> Go paint a happy tree or something |
09:36:00 | PMunch | Exactly! |
09:36:04 | FromDiscord | <Rika> Iâm not even trying to be rude this time |
09:36:14 | FromDiscord | <Rika> Iâm not even mad anymore what now |
09:36:40 | PMunch | Well saying to someone that they're shitting on you isn't particularly polite. And it's certainly not Nim-related.. |
09:36:56 | FromDiscord | <Rika> As if itâs polite to be the one doing it |
09:37:12 | FromDiscord | <Rika> Whatever |
09:37:27 | PMunch | @Zoom, could you please tell me what you're trying to achieve. What bigger picture is his factory going to fit into, and why doesn't the snippet you have now work in that scenario |
09:37:31 | FromDiscord | <Rika> I really donât get whatâs up with you guys |
09:38:02 | PMunch | @Rika, we're just trying to help someone in the Nim channel asking Nim questions |
09:38:08 | FromDiscord | <Elegantbeef> Nothing much, how bout you? |
09:38:22 | FromDiscord | <Rika> Apparently yâall think Iâm still mad or whatever |
09:38:33 | PMunch | Nope, you don't seem mad now :) |
09:38:36 | FromDiscord | <Rika> What now, am I the next one to be banned |
09:38:42 | FromDiscord | <Rika> Canât wait |
09:38:42 | PMunch | Not at all |
09:38:56 | FromDiscord | <Rika> Prolly should do it preemptively myself |
09:39:05 | PMunch | We don't ban people for having emotions |
09:39:06 | FromDiscord | <Schelz> Lame |
09:39:18 | FromDiscord | <Elegantbeef> So that iterator factory huh |
09:39:20 | PMunch | I know it says bot over my name, but I'm actually also human :P |
09:39:33 | FromDiscord | <Elegantbeef> That's yet to be decided pmunch |
09:39:37 | FromDiscord | <Rika> Again I assume itâs just some sort of partial function application |
09:39:47 | FromDiscord | <Schelz> How did you got the not tag ? |
09:39:53 | FromDiscord | <Schelz> (edit) "not" => "bot" |
09:39:54 | PMunch | Haha :P Just don't spill liquid around me and we're good @Elegantbeef |
09:40:01 | FromDiscord | <Rika> He makes a factory to get a function with no parameters but now he just wants the function straight |
09:40:09 | FromDiscord | <Rika> Itâs an assumption |
09:40:13 | FromDiscord | <Zoom> I was just experimenting with the piece of code tk showed here last night. He wanted to produce new iterators from a procedure which takes some args for those iters to use on initialization.â”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
09:40:15 | PMunch | @Schelz, because I'm on IRC and my messages are relayed to Discord |
09:41:56 | FromDiscord | <Zoom> If you return a straight iterator Nim treats it as one on invocation |
09:42:11 | FromDiscord | <Rika> Hm I donât remember that being the case |
09:43:19 | PMunch | Something like this? https://play.nim-lang.org/#ix=3F8j |
09:44:10 | FromDiscord | <Rika> TFW canât type code because on mobile |
09:44:24 | PMunch | Not with that attitude! :P |
09:44:30 | FromDiscord | <Rika> Also from last time I recall you can use closure iterator directly on for loops |
09:44:40 | PMunch | I've multiple times used the playground to type up Nim on mobile :P |
09:44:48 | PMunch | It's a massive pain in the ass, but it works |
09:44:53 | FromDiscord | <Rika> It takes significant time |
09:44:55 | FromDiscord | <Rika> Yeah |
09:46:04 | PMunch | You can do this can't you? https://play.nim-lang.org/#ix=3F8k |
09:46:23 | FromDiscord | <Rika> Yes |
09:46:29 | FromDiscord | <Elegantbeef> Cmon pmunch quit being a sadomasochist with that iterator definition https://play.nim-lang.org/#ix=3F8l |
09:46:31 | FromDiscord | <Rika> Thatâs what I was just making lol |
09:46:37 | FromDiscord | <Rika> Again, time consuming |
09:46:56 | PMunch | https://play.nim-lang.org/#ix=3F8m |
09:47:23 | PMunch | @Elegantbeef, what was wrong with my iterator definition? |
09:47:37 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8n |
09:47:50 | PMunch | Too many parenthesis for you @Elegantbeef= |
09:48:00 | FromDiscord | <Rika> Oh |
09:48:12 | FromDiscord | <Rika> Thatâs because the it iterator is treated as an inline one I believe |
09:48:24 | FromDiscord | <Rika> You need to put the closure pragma on it too |
09:48:26 | FromDiscord | <Rika> Then it should work |
09:48:35 | FromDiscord | <Elegantbeef> Nope |
09:48:43 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3F8o |
09:48:45 | FromDiscord | <Rika> So what is the issue |
09:49:10 | FromDiscord | <Rika> I just compiled what you sent and got an error lmfao |
09:49:31 | FromDiscord | <Rika> But itâs unrelated |
09:49:33 | FromDiscord | <Elegantbeef> I dropped the `myIter()` like a drongo |
09:50:00 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8q |
09:50:06 | PMunch | I don't see the problem @Zoom, seems to work just fine: https://play.nim-lang.org/#ix=3F8p |
09:50:18 | FromDiscord | <Rika> Maybe itâs to do with the consume parameter itâs type |
09:50:36 | FromDiscord | <Rika> Though itâs an implicit generic so |
09:50:38 | FromDiscord | <Rika> It should work |
09:50:39 | PMunch | @Zoom, well because you're taking an iterator() not an iterator(): int |
09:50:49 | FromDiscord | <Elegantbeef> Nope |
09:50:55 | FromDiscord | <Elegantbeef> `iterator` is a built in typeclass |
09:50:56 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3F8r |
09:50:57 | FromDiscord | <Zoom> Doesn't matterâ”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
09:50:57 | FromDiscord | <Rika> Nope to who me? |
09:50:58 | FromDiscord | <Elegantbeef> Works just fine |
09:51:07 | FromDiscord | <Rika> Yeah it should just work |
09:51:15 | FromDiscord | <Rika> Do you see any possible areas for errors? |
09:51:21 | FromDiscord | <Rika> Might be unrelated to this part of code |
09:52:08 | FromDiscord | <Elegantbeef> Yea i dont know |
09:52:40 | PMunch | @Zoom, with a generic return type it works just fine: https://play.nim-lang.org/#ix=3F8s |
09:53:02 | PMunch | Of course that requires your generic type to have a `+` procedure defined |
09:53:15 | FromDiscord | <Elegantbeef> Pmunch really making it complex đ |
09:53:38 | PMunch | Oh wait, is `iterator` an implicit generic? |
09:53:43 | FromDiscord | <Elegantbeef> `iterator` is a built in type class! It matches for any closure iterator! |
09:53:44 | FromDiscord | <Rika> Jesus thatâs large |
09:53:44 | PMunch | I thought you just said it wasn't :P |
09:53:48 | PMunch | Aaah |
09:53:50 | FromDiscord | <Rika> See I told you |
09:53:57 | FromDiscord | <Rika> Thatâs why I asked if it was towards me |
09:54:27 | FromDiscord | <Elegantbeef> I mean i thought it was clear from the follow up |
09:54:39 | PMunch | I was busy writing my own code :P |
09:54:40 | FromDiscord | <Elegantbeef> Anyway i have to walk through 30cm of snow to take out garbage |
09:54:55 | PMunch | All our snow rained away two days ago :( |
09:55:14 | * | pro joined #nim |
09:55:21 | FromDiscord | <Rika> Iâm thankful itâs not snowing yet |
09:55:34 | FromDiscord | <Rika> Not ready for metre deep snow yet |
09:55:44 | FromDiscord | <Rika> (Exaggeration) |
09:55:47 | FromDiscord | <Zoom> Ok, so one of the issues I was having is that `()` matter |
09:55:51 | FromDiscord | <Rika> I see |
09:55:56 | FromDiscord | <Rika> That makes sense yeah |
09:56:10 | FromDiscord | <Rika> Adding the parentheses makes it no longer an implicit generic I assume |
09:56:13 | FromDiscord | <Zoom> `iterator (): int{.closure.}` or `int` |
09:59:50 | FromDiscord | <Zoom> The other issue is that with returning an iterator and not a proc were' back at step one\: the factory isn't a factory if you need to pass the params on each invocation. If it's something large it's no bueno. That's what tk wanted. |
10:00:44 | FromDiscord | <Zoom> He wanted to instantiate a factory and use it repeatedly. |
10:00:58 | FromDiscord | <Zoom> That's why it returns a proc |
10:01:14 | FromDiscord | <Elegantbeef> I feel like the solution is just to make an object on instantiation that holds a single value, and the defaults |
10:01:40 | FromDiscord | <Rika> I honestly still donât get the full picture of what he wants |
10:01:42 | FromDiscord | <Zoom> My initial question was simply how to extract the function from the body of that factory |
10:01:51 | FromDiscord | <Rika> Extract in what way? |
10:02:01 | FromDiscord | <Zoom> It doesn't matter! We discuss a piece of code in isolation.â”(@Rika) |
10:02:08 | FromDiscord | <Rika> Okay understood |
10:02:21 | FromDiscord | <Rika> What do you exactly mean when you say extract |
10:02:54 | FromDiscord | <Zoom> Extract our of the enclosing procedure. |
10:02:56 | tk | I basically want new_iterator = functools.partial(iterator, params...) |
10:03:13 | tk | where new_iterator can be used to instantiate and isn't already instantiated |
10:03:31 | FromDiscord | <Rika> You call the function and store the return type, now you have âfl |
10:03:36 | FromDiscord | <Rika> âFâ, sorry typo |
10:04:28 | FromDiscord | <Rika> If you want to make iterators you then call f and use the return type |
10:04:43 | FromDiscord | <Rika> Being mindful that the returned iterators are stateful |
10:11:34 | FromDiscord | <Zoom> Ok, I think I know how to rephrase the issue. In the first example the returned procedure takes it's parameters from the enclosing context. If you extract the proc it now needs to take in an arg, but if I pass it, compiler treats it as an instantiation of that function |
10:11:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F8K |
10:11:46 | FromDiscord | <Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/910109833246670848): Ok, I think I know how to rephrase the issue. In the first example the returned procedure takes its parameters from the enclosing context. If you extract the proc it now needs to take in an arg, but if I pass it, compiler treats it as an instantiation of that function |
10:12:10 | FromDiscord | <Elegantbeef> It's not instantiating a new `it` on the next invocation of `a` |
10:12:12 | FromDiscord | <Rika> Beef because youâre calling f again which is returning a fresh iterator? |
10:12:14 | FromDiscord | <Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/910109833246670848): Ok, I think I know how to rephrase the issue. In the first example the returned procedure takes its parameters from the enclosing context. If you extract the proc it now needs to take in an arg, but if I pass it, compiler treats it as an invocation of that function |
10:12:27 | FromDiscord | <Elegantbeef> That's what you'd expect but no the iterator state is fucked |
10:12:38 | FromDiscord | <Rika> God someone replace the matrix bridge |
10:12:41 | FromDiscord | <Rika> Itâs so fucked |
10:13:09 | FromDiscord | <Rika> Beef sounds like a bug now time for you to do what you always do |
10:13:09 | FromDiscord | <Elegantbeef> Ah nvm you're probably right |
10:13:10 | FromDiscord | <Rika> Half kidding |
10:13:16 | FromDiscord | <Rika> Oh lol |
10:15:08 | PMunch | @Zoom, so you want something like this? https://play.nim-lang.org/#ix=3F8L |
10:15:31 | PMunch | Create a factory with arguments, then call the factory without an argument and get fresh iterators of the same kind every time |
10:15:55 | FromDiscord | <Rika> Yeah I think the factory naming is kinda misleading |
10:16:12 | FromDiscord | <Rika> âIterator factoryâ is actually an âiterator factory factoryâ |
10:16:13 | FromDiscord | <Zoom> I already got that in the first exampleâ”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:16:30 | tk | it's not an iterator factory, it's an iterator factory factory |
10:16:36 | tk | the iterator factory is what it returns |
10:16:46 | PMunch | No one buys hammers any more |
10:17:05 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3F8O hmmm does this meet any criteria? |
10:17:20 | FromDiscord | <Elegantbeef> Using the iterator inline instantiates a new iterator every tick which causes badnews |
10:18:33 | FromDiscord | <Rika> Yup thatâs what I said TK |
10:18:39 | FromDiscord | <Rika> PMunch nice |
10:18:40 | tk | at least it's not a an abstract singleton proxy factory bean |
10:18:46 | FromDiscord | <Rika> Welcome to Java hell I guess |
10:19:33 | tk | ah yea, the iterator thing, I found that bug yesterday (where it loops forever0 |
10:19:36 | tk | I was confused too |
10:19:40 | PMunch | I'm still not sure why the last code snippet I shared isn't exactly what you want? |
10:19:40 | FromDiscord | <Rika> Itâs not really a bug |
10:19:44 | tk | I wasn't sure if I had done something wrong or not |
10:19:47 | FromDiscord | <Rika> Itâs just a confusing idea |
10:19:51 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8P |
10:19:57 | FromDiscord | <Rika> ? |
10:20:11 | FromDiscord | <Zoom> Now I want to take `f` out somehowâ”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:20:14 | FromDiscord | <Rika> You just changed the name? Or am I being blind |
10:20:17 | FromDiscord | <Elegantbeef> Yea tk i just threw a bunch of guesses at it until it stopped running |
10:20:19 | tk | Well yes, the abstract singleton proxy factory bean^W^W^W^Witerator factory factory IS what I want |
10:20:26 | tk | it's exactly what I came up with |
10:20:32 | PMunch | `result = proc (): iterator (): int` |
10:20:33 | tk | but the problem is that it's clunky |
10:20:39 | PMunch | Instead of proc f and then return f |
10:21:00 | PMunch | tk, well it's a clunky concept :P |
10:21:04 | tk | is it really? |
10:21:07 | tk | it's not clunky in python |
10:21:09 | PMunch | But you could always make a template or something out of it |
10:21:10 | FromDiscord | <Rika> ~~you can even omit the result = part~~ |
10:21:23 | tk | right, the problem is having to call 50 times |
10:21:28 | tk | the syntax still confuses me |
10:21:28 | PMunch | tk, I mean it's a clunky OO pattern :P |
10:21:31 | tk | not really |
10:21:32 | FromDiscord | <Elegantbeef> tk i'm going to see if i can abstract this any using a macro tomorrow |
10:21:42 | tk | this has nothing to do with OO, it could be an entirely functional concept |
10:21:43 | PMunch | We typically don't do that in Nim |
10:21:55 | FromDiscord | <Elegantbeef> I do like the idea of a resetable closure |
10:21:57 | tk | in fact, I could write this in scheme with fewer parentheses |
10:22:00 | FromDiscord | <Rika> Beef you mean youâre gonna make a partial function applicator? |
10:22:08 | tk | (actually, don't quote me on that, I'm sure there will be more parentheses) |
10:22:09 | FromDiscord | <Elegantbeef> I dont speak french |
10:22:12 | tk | but it's just partial function application |
10:22:12 | FromDiscord | <Rika> Donât we have that already |
10:22:15 | FromDiscord | <Rika> Yes |
10:22:17 | FromDiscord | <Zoom> Could you show it to me on the example I provided please?â”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:22:23 | tk | and if iterators were just "functions" then it would work |
10:22:26 | tk | but it doesn't |
10:22:32 | PMunch | @Zoom, which one? |
10:22:43 | tk | now I get why iterators aren't "just functionsâą" but it doesn't mean that this should be entirely applicable to them |
10:23:06 | PMunch | Hmm, someone has to have written a partial function application library in Nim |
10:23:15 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8Q |
10:23:17 | PMunch | It's just a little bit of macro magic I believe |
10:23:34 | FromDiscord | <Elegantbeef> I wager as such, but i still dont speak french đ |
10:23:35 | FromDiscord | <Zoom> Can you do it without macro? |
10:24:02 | tk | Zoom: I don't think you have to specify {.closure.} there explicitly, it's implicit since you're returning it to begin with |
10:24:06 | PMunch | @Zoom: https://play.nim-lang.org/#ix=3F8S |
10:24:11 | tk | at least that's how I justify it in my head |
10:24:19 | PMunch | Yes, it should be implicit |
10:24:25 | FromDiscord | <Elegantbeef> Indeed tk, iterators in typedefs are implicitly closures |
10:24:26 | FromDiscord | <Rika> Beef you better speak french |
10:24:37 | FromDiscord | <Elegantbeef> Nah i'm a terrible Canadian |
10:24:50 | FromDiscord | <Zoom> ? The function body is still inside.â”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:24:55 | FromDiscord | <Rika> Nah Iâm pretty sure only those in Quebec actually speak french |
10:25:16 | tk | I like how in the process of trying to use nim to solve 2019 AOC I have found 2 weird compiler bugs and started an intense discussion about iterators |
10:25:19 | FromDiscord | <Elegantbeef> Quebec, NB, Alberta have sizeable francophones |
10:25:35 | FromDiscord | <Rika> Iâm not from Canada I donât know what NB means |
10:25:44 | FromDiscord | <Rika> New Banana |
10:25:53 | FromDiscord | <Elegantbeef> New Brunswick it's a province |
10:26:09 | FromDiscord | <Rika> Hey I got one word right |
10:26:25 | tk | that's a 50% success rate, otherwise known as a majority |
10:26:31 | FromDiscord | <Elegantbeef> Well the one bug isnt that weird |
10:26:37 | FromDiscord | <Rika> No a majority is 50%+1 |
10:26:52 | FromDiscord | <Elegantbeef> Nim has multiple bugs using typeclasses as return types since not one bothers to check if that's the case |
10:27:16 | tk | Elegantbeef: Except for the fact that if you don't store it in a variable it doesn't break, and if you move the closure out of the function it doesn't break |
10:27:22 | tk | so it's kind of still weird |
10:27:33 | tk | but sure, it's a weird corner case |
10:27:43 | FromDiscord | <Elegantbeef> No i mean the using built in typeclass as return type error |
10:28:03 | tk | yeah, that's also the one I meant |
10:28:06 | tk | this is the other one https://github.com/nim-lang/Nim/issues/19154 |
10:28:07 | FromDiscord | <Rika> Whatâs that error? |
10:28:11 | PMunch | @Zoom, wait you don't want the function body inside your function? |
10:28:18 | tk | Rika: https://github.com/nim-lang/Nim/issues/19153 |
10:28:21 | PMunch | That's where function bodies are supposed to be.. |
10:28:33 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/issues/19153 if you just check if the return type on `semProc` is a `tyBuiltInTypeClass` or `tyUserTypeClass` the error goes away |
10:29:02 | FromDiscord | <Elegantbeef> Araq says that typeclasses shouldnt be usable there or for variable instantiations, so it probably should be done |
10:29:45 | FromDiscord | <Zoom> Yep, that's literally what my first question today was.â”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:30:10 | FromDiscord | <Rika> So thatâs what you mean by extractâŠ. |
10:31:02 | tk | No, that's not what I meant by extract |
10:31:08 | tk | or what zoom meant I don't thinl |
10:31:10 | FromDiscord | <Rika> No I mean zoom |
10:31:17 | FromDiscord | <Rika> Really? |
10:31:21 | tk | zoom meant what I meant because I think he's on the same page as me |
10:31:35 | tk | in any case |
10:31:44 | tk | I need to get back to work. |
10:31:48 | FromDiscord | <Zoom> You're overestimating me đ
â”(<@709044657232936960_tk=5b=49=52=43=5d>) |
10:31:49 | FromDiscord | <Rika> See you |
10:32:15 | tk | ah, so THAT's what the weird number thing is |
10:32:23 | tk | (<@709044657232936960_tk=5b=49=52=43=5d>) - it's a reference to an IRC user |
10:32:27 | tk | horrific |
10:32:37 | FromDiscord | <Rika> No a reference to a discord user |
10:32:46 | tk | But I don't exist on discord. |
10:32:53 | FromDiscord | <Rika> You do technically |
10:33:00 | tk | Wow, I feel mildly violated. |
10:33:07 | tk | For real though, I have to go. |
10:33:13 | FromDiscord | <Rika> Itâs irc <> discord <> matrix |
10:34:09 | PMunch | Yeah those numbers aren't great.. |
10:34:23 | PMunch | It also means I don't get pinged when you reply to me.. |
10:34:33 | PMunch | Because that weird ID string doesn't contain my name |
10:34:45 | FromDiscord | <Elegantbeef> I mean who wants to talk to you anyway đ |
10:34:59 | PMunch | Jokes on you, you're talking to me right now! |
10:35:18 | FromDiscord | <Elegantbeef> This cant be so! |
10:35:23 | FromDiscord | <Elegantbeef> I now go to sleep, so jokes on you |
10:35:44 | PMunch | Good night |
10:37:19 | FromDiscord | <Rika> Imagine sleeping |
10:37:27 | FromDiscord | <Rika> I just down my 5th cup of espresso |
10:43:27 | FromDiscord | <Zoom> Anyway, Rika might have been somewhat correct in his evaluation. I'm dumb. |
10:44:43 | FromDiscord | <Rika> Well letâs just say everything that just happened was a massive lump of miscommunication |
10:44:46 | FromDiscord | <Rika> Sorry |
10:44:54 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8W |
10:47:55 | PMunch | I guess you could also make a template to easy the usage of this pattern |
10:48:01 | FromDiscord | <Zoom> I'm sorry too for being too mordant.â”(@Rika) |
10:48:08 | FromDiscord | <Rika> What does mordant mean |
10:48:14 | FromDiscord | <Rika> Lol okay wait Iâll search it |
10:48:27 | FromDiscord | <Rika> Oh |
10:51:33 | FromDiscord | <Zoom> Don't know how usable it is, but I think in some cases it would be preferable to `reset` macro magic by Beef.â”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
10:52:07 | PMunch | Maybe something like this: https://play.nim-lang.org/#ix=3F8Y |
10:52:59 | PMunch | A tiny bit of macro magic and you can even turn that into a pragma |
10:53:18 | PMunch | But that's left as an exercise for the reader |
10:53:26 | FromDiscord | <Zoom> That looks nice |
10:54:56 | FromDiscord | <retkid> hety |
10:54:57 | FromDiscord | <retkid> (edit) "hety" => "hey" |
10:55:02 | PMunch | Hello |
10:55:11 | FromDiscord | <retkid> it appears that writeFile is having problems writing a large amount of data |
10:55:24 | FromDiscord | <retkid> ie 8000 images in a json format with 260 mbs of t ext |
10:55:26 | FromDiscord | <retkid> (edit) "t ext" => "text" |
10:55:38 | FromDiscord | <retkid> is this expected behaviour |
10:56:06 | PMunch | Define problems |
10:56:09 | FromDiscord | <Rika> I mean thatâs a lot of data |
10:56:11 | FromDiscord | <retkid> i should probably put those images into base 96 anyway |
10:56:25 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/910121117434396692/unknown.png |
10:56:33 | PMunch | You should probably not store those images as JSON :P |
10:56:41 | FromDiscord | <retkid> wellllll |
10:56:56 | FromDiscord | <retkid> its raw image data |
10:56:57 | FromDiscord | <retkid> (edit) "its raw image data ... " added "as a string" |
10:57:01 | FromDiscord | <retkid> in a class |
10:57:38 | PMunch | So save that as an image and put references to them in your JSON? |
10:57:50 | PMunch | JSON really isn't a good choice for binary data |
10:58:32 | FromDiscord | <retkid> but its more convenient to just query the server and get sent the data |
10:58:50 | FromDiscord | <retkid> im gonna encode it |
10:58:57 | FromDiscord | <retkid> it works fine with like 100 images |
10:59:06 | FromDiscord | <retkid> (edit) "100" => "1000" |
11:00:33 | PMunch | But you're going to be sending so much more data than you actually need to send :S |
11:00:59 | FromDiscord | <Rika> Is there a reason you use json |
11:01:09 | FromDiscord | <retkid> just because marshal |
11:01:18 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix= |
11:03:54 | FromDiscord | <Rika> There are better formats you can use that are already implemented, just in other libraries |
11:03:58 | PMunch | Hmm, I have a program that is just sending and receiving DNS messages. It works perfectly fine for about 1500 queries, but then suddenly it stops working and just piles up memory until it crashes |
11:04:11 | PMunch | Up until that point memory usage is completely static |
11:04:16 | FromDiscord | <Rika> Debugger time I assume |
11:04:57 | PMunch | I mean I'm not even sure what to debug.. |
11:05:13 | PMunch | It's just killed by zsh for consuming a lot of memory |
11:05:48 | PMunch | It also jumps from 12.5% CPU to 100% CPU |
11:05:55 | PMunch | Right before crashing |
11:07:47 | FromDiscord | <Rika> Yeah maybe step through the program or so |
11:08:00 | FromDiscord | <Rika> Wait I donât think that would work well |
11:08:47 | FromDiscord | <retkid> In reply to @Rika "There are better formats": can you give me an example for a better format for seralization |
11:08:50 | FromDiscord | <retkid> (edit) "seralization" => "serialization" |
11:09:19 | FromDiscord | <retkid> i upgraded from Marshal but apparentlyâ” im still not a cool kid |
11:09:23 | FromDiscord | <retkid> (edit) "apparentlyâ”" => "apparently" |
11:09:47 | FromDiscord | <enthus1ast> @retkid\: maybe msgpack is more efficient and quite the same convince |
11:10:07 | FromDiscord | <enthus1ast> But idk how well it packs binary data |
11:10:14 | FromDiscord | <retkid> I've added a base64 encoder |
11:10:17 | FromDiscord | <retkid> i thought it would be a pain |
11:10:22 | FromDiscord | <retkid> (edit) "i thought it would be a pain ... " added "but it seems really simple" |
11:10:27 | FromDiscord | <retkid> literally juse |
11:10:28 | FromDiscord | <retkid> (edit) "juse" => "just" |
11:10:30 | FromDiscord | <retkid> encode() |
11:10:37 | FromDiscord | <Rika> Message pack protocol buffers CBOR BSON etc |
11:11:04 | FromDiscord | <Rika> Is there a reason these images arenât just hosted as images and have to be in json? |
11:11:34 | FromDiscord | <retkid> I think it'll just be more convenient and simple on the frontend |
11:11:51 | FromDiscord | <Rika> Convenient I donât think so |
11:16:58 | FromDiscord | <retkid> In reply to @Rika "Convenient I donât think": it'll literally be decodeURIComponent(escape(window.atob(img))); |
11:17:07 | PMunch | Remember you'd have to demarshal and rebuild the images in JS on the grontend.. |
11:17:08 | FromDiscord | <retkid> (edit) "In reply to @Rika "Convenient I donât think": it'll literally be decodeURIComponent(escape(window.atob(img)));" => "sent a code paste, see https://paste.rs/OV0" |
11:17:21 | FromDiscord | <retkid> In reply to @PMunch "Remember you'd have to": thats already done |
11:17:22 | PMunch | Instead of just creating an image tag with a url |
11:17:26 | FromDiscord | <Rika> And if you just hosted it normally you wouldnât need to do any of this demarshalling |
11:17:34 | PMunch | And let the browser handle the heavy lifting |
11:17:59 | PMunch | Your site would be pretty slow if it's loading all that JavaScript and demarshalling it into images is my guess |
11:18:32 | FromDiscord | <retkid> i suppose you are right but im afraid I'll be pinging sites too many times if people use it and people will be on my ass |
11:18:45 | FromDiscord | <retkid> but |
11:18:49 | FromDiscord | <retkid> maybe im just paranoid |
11:18:55 | FromDiscord | <retkid> probably doesn't matter |
11:18:57 | FromDiscord | <Rika> You can cache it on your backend |
11:31:43 | FromDiscord | <PutoPie> how do i install nim on raspberry pi 4? I've downloaded nim-1.7.1-linux_arm64.tar.xz |
11:35:18 | FromDiscord | <Zoom> Why not use the one your disto package manager offers?â”(@PutoPie) |
11:36:32 | PMunch | Those tend to be quite out of date.. |
11:37:47 | FromDiscord | <Zoom> But then you can compile choosenim |
11:44:15 | PMunch | Ah, so you want to use the built-in package to build choosenim then install Nim through choosenim and remove the distro package? |
11:44:22 | FromDiscord | <hmmm> boys if nim -v says Windows: i386 it measn I have the 32bit version of nim? |
11:44:52 | FromDiscord | <Schelz> I have a question I want to make a read request from a local webpage with nginx but I enabled auth so when i make a requst i have to login first with POST and i dont know how. |
11:45:57 | FromDiscord | <Schelz> For example ik that it would something like this http://user:[email protected]/Example |
11:46:18 | FromDiscord | <Schelz> (edit) "http://user:[email protected]/Example" => "http:/user:[email protected]/Example" |
11:53:55 | FromDiscord | <Yardanico> In reply to @Schelz "I have a question": that's usually basic authentication |
11:53:56 | FromDiscord | <hotdog> In reply to @Schelz "I have a question": You need to set a header |
11:54:06 | FromDiscord | <Yardanico> it's not in httpclient but it's pretty simple to do just by setting a header with correct values |
11:54:16 | FromDiscord | <hotdog> Yeah ^ |
11:54:40 | FromDiscord | <hotdog> It'll be something like `Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==` |
11:54:53 | FromDiscord | <hotdog> With the correct details of course |
11:55:13 | FromDiscord | <Yardanico> yeah, @Schelz , Basic auth is just "login:password" base64-encoded |
11:57:44 | FromDiscord | <Rika> ~~please donât use in prod~~ |
11:58:20 | FromDiscord | <Yardanico> yeah basic auth is pretty outdated nowadays, and if you're not using https you're basically sending your login and password over the internet in cleartext |
12:00:15 | pro | but if you put nginx with tls infront ? |
12:00:31 | FromDiscord | <Yardanico> well I specifically said "not https" |
12:00:41 | FromDiscord | <Yardanico> with https headers are encrypted so only you and the server see them |
12:04:09 | FromDiscord | <Schelz> So i have to done it from nginx ? |
12:04:22 | FromDiscord | <Yardanico> @Schelz nonono, if you just need basic auth you just set a header with correct values |
12:04:44 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3F9e |
12:05:07 | FromDiscord | <Schelz> Perfect example thx |
12:05:15 | FromDiscord | <Yardanico> as others said above, basic authentication is just an `Authentication` header with `Basic ` and base64-encoded login<colon>password |
12:05:34 | FromDiscord | <Schelz> Got it know |
12:05:41 | FromDiscord | <Schelz> (edit) "know" => "now" |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:11 | FromDiscord | <Yardanico> mdn has quite a lot of docs for things like that, for example https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization |
12:06:32 | * | supakeen joined #nim |
12:14:41 | FromDiscord | <hmmm> hmm how can I tell choosenim I want the 64bit |
12:17:32 | FromDiscord | <PutoPie> sent a code paste, see https://play.nim-lang.org/#ix=3F9h |
12:18:36 | FromDiscord | <Yardanico> In reply to @PutoPie "I tried installing nim": any reason why you won't download the choosenim binary so you don't have to compile it yourself? |
12:18:43 | FromDiscord | <Yardanico> probably nim in your distro is very old |
12:20:32 | FromDiscord | <PutoPie> its 0.19.4 đ€·ââïž |
12:20:34 | FromDiscord | <Zoom> I've recently compiled choosenim on for 32bit on debian bullseye without issues. |
12:20:40 | FromDiscord | <Zoom> Yep, that's old |
12:21:53 | FromDiscord | <Yardanico> In reply to @PutoPie "its 0.19.4 đ€·ââïž": yes that is very old, so it's better if you download the choosenim binary |
12:22:05 | FromDiscord | <Yardanico> or download compiled nim 1.6 if you really want to compile choosenim yourself |
12:22:10 | FromDiscord | <Zoom> He's on arm, there's no binaries |
12:22:11 | FromDiscord | <Yardanico> also don't forget to uninstall your distro-installed nim |
12:22:13 | FromDiscord | <Yardanico> In reply to @Zoom "He's on arm, there's": there are |
12:23:12 | FromDiscord | <Yardanico> https://github.com/nim-lang/nightlies/releases/tag/latest-version-1-6 |
12:23:20 | FromDiscord | <Yardanico> despite the "nightlies" name it's the build from the 1.6 branch |
12:23:28 | FromDiscord | <Yardanico> and there are binaries for amd64 and armv7l |
12:24:06 | FromDiscord | <hmmm> hmm apparently choosenim checks your installed mingw version and just decides "yea dude you will be fine with the 32bit" |
12:24:36 | FromDiscord | <hmmm> so I just went and grabbed the 64zip the primitive way and ran finish.exe |
12:24:37 | FromDiscord | <Yardanico> In reply to @Yardanico "and there are binaries": i meant arm64 and armv7l (if we're talking about arm) |
12:24:37 | FromDiscord | <Zoom> Wait, there aren't choosenim binaries.â”(@Yardanico) |
12:24:51 | FromDiscord | <Yardanico> In reply to @Zoom "Wait, there aren't choosenim": yes, but if he wants to compile choosenim he needs a recent nim anyway |
12:24:57 | FromDiscord | <PutoPie> yes i downloaded .tar.xz in github, now how do I install it on raspberry pi? Is there a way like on windows you can add the path of the .exe to the PATH then you can call .exe anywhere? |
12:25:01 | PMunch | You can also unzip and to `choosenim .` IIRC |
12:25:13 | FromDiscord | <Yardanico> In reply to @PutoPie "yes i downloaded .tar.xz": yes |
12:25:32 | NimEventer | New thread by JPLRouge: I made a publication, a job with MSGSHM, see https://forum.nim-lang.org/t/8633 |
12:25:33 | FromDiscord | <Yardanico> you need unpack the archive and add the "bin" folder inside of it to your PATH |
12:30:04 | FromDiscord | <Zoom> I like how JPLRouge skips full stops in this post and then just puts a bunch of them to compensate. |
12:30:41 | FromDiscord | <PutoPie> In reply to @Yardanico "you need unpack the": i'll copy the contents of nim-1.7.1/bin to /bin? |
12:30:49 | FromDiscord | <Yardanico> nonono |
12:31:08 | FromDiscord | <Yardanico> you just uncompress the whole nim folder, move it anywhere you like, and add nim/bin folder to your PATH |
12:31:31 | FromDiscord | <Yardanico> so e.g. you can move your `nim-1.7.1` to `/home/myuser/nim/` and then add `/home/myuser/nim/bin` to PATH |
12:34:23 | FromDiscord | <PutoPie> oh I get it now, i will have to add to evironment variable, thanks |
12:35:23 | PMunch | Well this was a dumb error.. My program kept crashing, turns out `readChar`, unlike all the other stream reading procedures return 0 as an EOF marker instead of throwing an IOException.. |
12:36:36 | PMunch | @Zoom, that is certainly one way of doing it.. >_< |
13:12:34 | * | neurocyte0132889 quit (Quit: The Lounge - https://thelounge.chat) |
13:15:46 | * | neurocyte0132889 joined #nim |
13:15:46 | * | neurocyte0132889 quit (Changing host) |
13:15:46 | * | neurocyte0132889 joined #nim |
13:20:26 | FromDiscord | <dom96> In reply to @hmmm "hmm apparently choosenim checks": If you want 64bit why do you have a 32bit mingw in your PATH? đ |
13:20:58 | FromDiscord | <hmmm> that's a very intriguing question lol |
13:20:58 | FromDiscord | <dom96> But yeah. We should make choosenim ask |
13:21:02 | FromDiscord | <hmmm> I don't know! |
13:21:08 | FromDiscord | <hmmm> đ |
13:21:15 | FromDiscord | <dom96> But then you run risk of mismatches |
13:21:46 | FromDiscord | <hmmm> the primitive way was well set imo, you grab the zip 64, and finish will set the PATHs and will also download the correct mingw |
13:21:58 | FromDiscord | <hmmm> choosenim should do the same maybe |
13:22:57 | FromDiscord | <dom96> You can run into a broken install though. |
13:23:11 | FromDiscord | <dom96> If your 32 bit gcc is in front of the installed one |
13:23:31 | FromDiscord | <hmmm> hmm, I guess I will need to clean the house a bit |
13:24:35 | FromDiscord | <hmmm> don't wtf is happening with my compilers tbh I have 2 mingw, 1 winbuilds, 1 msys64 laying around |
13:24:49 | FromDiscord | <hmmm> I guess it all works out? lol |
13:25:09 | FromDiscord | <Rika> Lmao |
13:32:06 | * | rockcavera quit (Remote host closed the connection) |
13:37:29 | PMunch | Hmm, I'm still not entirely sure what's "legal" and not when it comes to ARC and threading.. |
13:42:51 | FromDiscord | <dom96> Stop. You have committed an offence against the ARC of Nim |
13:43:15 | FromDiscord | <Clonkk> Try mixing that with sharing ref through channels so it's even more fun to debugâ”(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:46:41 | PMunch | @Clonkk, oh I've got significantly more "sinister" plans :P |
13:46:56 | PMunch | Trying "steal" an iterator from one thread to another |
13:47:06 | PMunch | Without the first thread being involved at all |
13:47:23 | PMunch | Just copying the ref to the iterator from one thread to the other |
14:01:32 | FromDiscord | <tandy> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: honorable mention in the readme https://gitlab.com/tandy1000/listenbrainz-nim |
14:04:41 | FromDiscord | <Yardanico> https://github.com/vanyle/SublimeNim |
14:04:57 | FromDiscord | <Yardanico> seems like a plugin based (at least syntax) on nimlime for st4 |
14:05:11 | FromDiscord | <Yardanico> "Pull requests are not welcome. Fork this project if you want to add stuff. Open an issue if you have a problem." đ |
14:07:48 | PMunch | Haha, that's a weird line to take :P |
14:09:26 | FromDiscord | <Yardanico> i mean it's nothing bad, it's up to everyone to decide how they want their repos to be :) |
14:09:31 | FromDiscord | <Yardanico> but yeah, kinda unusual |
14:10:38 | FromDiscord | <Recruit_main707> I guess they have plans already made |
14:14:21 | FromDiscord | <Clonkk> Well it must not be ready yet, I tried it it doesn't highlight syntaxâ”(@Yardanico) |
14:14:28 | FromDiscord | <Yardanico> huh? that's weird |
14:14:35 | FromDiscord | <Yardanico> it does highlight in the screenshot shown |
14:16:35 | FromDiscord | <Clonkk> Ah interesting |
14:16:45 | FromDiscord | <Clonkk> I had to dsiable NeoVintageous to get it to work |
14:16:50 | FromDiscord | <Clonkk> Then once I re-enabled it |
14:16:54 | FromDiscord | <Clonkk> It's fine |
14:28:03 | * | arkurious joined #nim |
15:14:15 | tk | Okay, I just want something like file.lines but where I control the separator to be something else. Am I supposed to provide Stream overloads for nxt and atom and use pscan or what? |
15:15:40 | tk | (i.e., I want to parse things out of a stream without necessarily reading the entirety of it all at once because it may be too large or potentially "infinite") |
15:18:12 | FromDiscord | <Clonkk> sent a code paste, see https://play.nim-lang.org/#ix=3FaG |
15:18:38 | FromDiscord | <Clonkk> Ah nvm, you just added "without reading the entire things" ^^ |
15:57:31 | FromDiscord | <IsaacPaul> In reply to @tk "Okay, I just want": https://nim-lang.org/docs/memfiles.htmlâ”the lines function allows you to specify a delimiter |
15:58:54 | * | pro quit (Quit: WeeChat 3.3) |
16:00:25 | FromDiscord | <IsaacPaul> This looks like it does exactly what you want to do.. but.. I was wrong before so đ€·ââïž đ |
16:03:03 | tk | yes, this looks promising |
16:04:28 | NimEventer | New post on r/nim by SamLovesNotion: How to create a 'then' macro which can be used instead of ':' in if statements?, see https://reddit.com/r/nim/comments/qvb2ub/how_to_create_a_then_macro_which_can_be_used/ |
16:16:38 | FromDiscord | <Schelz> sent a long message, see http://ix.io/3FaZ |
16:17:01 | FromDiscord | <Schelz> (edit) "http://ix.io/3FaZ" => "http://ix.io/3Fb0" |
16:17:47 | FromDiscord | <Schelz> (edit) "http://ix.io/3Fb0" => "http://ix.io/3Fb1" |
16:18:20 | FromDiscord | <Schelz> (edit) "http://ix.io/3Fb1" => "http://ix.io/3Fb2" |
16:18:27 | FromDiscord | <Schelz> (edit) "http://ix.io/3Fb2" => "https://paste.rs/sZF" |
16:18:52 | tk | incidentally, the FromDiscord bot could just use ix.io's edit feature to edit an existing paste |
16:19:50 | FromDiscord | <enthus1ast> @Schelz\: what crashes and how (what error?) |
16:20:34 | FromDiscord | <Schelz> i compile it with nim c Test.nim |
16:21:12 | FromDiscord | <Schelz> its not printing any error at the compiling only when run the exe bump up console and close instantly |
16:21:55 | FromDiscord | <enthus1ast> Run it from a terminal so that it won't close immediately |
16:21:56 | FromDiscord | <Schelz> it could be from an arg ? |
16:22:35 | FromDiscord | <Schelz> the request was printed so fast that the console dont even had time to print it |
16:22:43 | FromDiscord | <Schelz> (edit) "print" => "see" |
16:22:48 | FromDiscord | <dom96> yeah, you need to run cmd.exe manually |
16:22:50 | FromDiscord | <Schelz> got it working from terminal |
16:22:53 | FromDiscord | <dom96> and then run your program from it |
16:22:55 | FromDiscord | <Schelz> thx |
16:23:05 | FromDiscord | <dom96> you can also use `nim c -r test.nim` to compile and run |
16:23:28 | FromDiscord | <Schelz> i forgot about that -r đ |
16:24:23 | * | PMunch quit (Quit: leaving) |
16:29:24 | FromDiscord | <hmmm> very suspect |
16:30:21 | * | audiophile_ joined #nim |
16:31:21 | FromDiscord | <hmmm> if I call my program.nim exe in terminal it executes normally, if I change folder and call C:\Path\to\program.exe I get a io.nim(853) unhandled exception: cannot open: unrelatedfile.json |
16:34:42 | FromDiscord | <Recruit_main707> may you post the exact commands? |
16:38:57 | FromDiscord | <hmmm> well it shouldn't matter in theory, if it works inside the folder I don't see why it wouldn't outside the folder. I'm cleaning up a bit and see if I can reduce the bullshit |
16:40:29 | FromDiscord | <Recruit_main707> thats why i think you must be doing somrthing wrong when calling it |
16:41:04 | FromDiscord | <hmmm> I mean it's a path đ§ |
16:43:09 | FromDiscord | <Rika> thats how cwd works? |
16:44:43 | FromDiscord | <Rika> any "bare filenames" (in reality relative paths, ex. `filename.ext` or so) gets "translated by the os" into cwd / filename (absolute paths, `C:\...\filename.ext` or so) |
16:44:54 | FromDiscord | <Rika> at least that's the common behavior |
16:45:36 | * | audiophile_ quit (Quit: Default Quit Message) |
16:46:36 | FromDiscord | <hmmm> the path is fine if I change .exe to .nim it opens vscode with the file |
16:47:27 | FromDiscord | <Rika> i dont understand what the issue is now, more context is needed |
16:49:53 | FromDiscord | <hmmm> I can't even explain it lol it's just weird, it all started when I wanted to execute this shit with task scheduler. Ofc task scheduler can't. So I went to the rabbit hole and started scripting batch files that called the exes so I task schedule those, but then I discovered this weird shit that from outside the folder I cannot call the exe just won't run, while from inside it runs. I thought it had to do with elevated priviledge but it's not |
16:50:19 | mikko | sounds like you just have the wrong working directory |
16:50:27 | mikko | https://superuser.com/questions/396394/how-do-i-set-an-executables-working-directory-via-the-command-line-prior-to-ex |
16:51:04 | FromDiscord | <hmmm> hmm |
16:51:18 | FromDiscord | <Rika> pretty much as i said yeah but i thought you knew what cwd meant |
16:51:39 | * | rockcavera joined #nim |
16:51:39 | * | rockcavera quit (Changing host) |
16:51:39 | * | rockcavera joined #nim |
16:56:01 | FromDiscord | <hmmm> oh I see you need to tell terminal the working directory because he doesn't know |
17:06:18 | FromDiscord | <hmmm> yay it works, apparently the batch incantation is: start /d "C:\Path\To" program.exe |
17:06:24 | * | u0_a185 joined #nim |
17:06:24 | FromDiscord | <hmmm> windows is weird as hell |
17:06:31 | FromDiscord | <hmmm> mikko :nim1: |
17:13:36 | * | u0_a185 quit (Quit: WeeChat 3.0.1) |
17:45:04 | NimEventer | New post on r/nim by SamLovesNotion: nimlsp is looking for system.nim file inside project directory [Neovim], see https://reddit.com/r/nim/comments/qvdeor/nimlsp_is_looking_for_systemnim_file_inside/ |
17:47:50 | * | audiophile_ joined #nim |
18:08:41 | * | krux02_ joined #nim |
18:39:55 | FromDiscord | <Schelz> Why is nimpy not working to install ? https://media.discordapp.net/attachments/371759389889003532/910237763369041991/unknown.png |
18:51:23 | NimEventer | New post on r/nim by SamLovesNotion: Where can I find the docs for Nim config files like `nim.cfg`, `xyx.nims` and `xyz.nimble`?, see https://reddit.com/r/nim/comments/qveyyf/where_can_i_find_the_docs_for_nim_config_files/ |
18:59:26 | NimEventer | New post on r/nim by SamLovesNotion: Where can I find the docs for Nim .cfg config files like `nim.cfg`?, see https://reddit.com/r/nim/comments/qvf5o4/where_can_i_find_the_docs_for_nim_cfg_config/ |
19:06:05 | FromDiscord | <hotdog> In reply to @Schelz "Why is nimpy not": What version of Nim? |
19:06:12 | FromDiscord | <hotdog> And what's the contents of that file? |
19:06:38 | FromDiscord | <Schelz> sent a long message, see http://ix.io/3FbL |
19:07:02 | FromDiscord | <Schelz> the version i think its v0.9.0 |
19:07:09 | FromDiscord | <Schelz> im on rpi 4 so.... |
19:16:43 | tk | is the 1.6 tag buildable? |
19:17:10 | FromDiscord | <dom96> In reply to @Schelz "the version i think": that's a very old version |
19:21:53 | FromDiscord | <Schelz> i just typed sudo apt install nim |
19:22:01 | FromDiscord | <Schelz> thats the version i got đ |
19:23:33 | FromDiscord | <Schelz> try to get from the nim page the tar and install it manually |
19:23:39 | FromDiscord | <Schelz> (edit) |
19:23:55 | FromDiscord | <reilly> In reply to @Schelz "i just typed sudo": Yes, sadly the apt version is quite out of date |
19:25:32 | FromDiscord | <Rika> Quite? |
19:25:56 | FromDiscord | <Rika> Youâre saying that as if 0.9 isnât over 15 versions old |
19:26:36 | FromDiscord | <reilly> Very out of date. |
19:26:37 | FromDiscord | <Rika> I donât even think there is online documentation for 0.9 |
19:28:08 | FromDiscord | <Schelz> Hahaa lol |
19:35:36 | FromDiscord | <dom96> https://nim-lang.org/blog/2012/09/23/version-090-released.html |
19:35:38 | FromDiscord | <dom96> 2021! |
19:35:43 | FromDiscord | <dom96> (edit) "2021!" => "2012!" |
19:36:28 | FromDiscord | <dom96> "Closures have been implemented." those were the days |
19:36:29 | FromDiscord | <Schelz> you actually find it lol |
19:39:23 | FromDiscord | <Schelz> well lets say i kinda got i work like i download the tar file and install the ./install.sh in the /usr/bin/nim but i get an error |
19:39:30 | FromDiscord | <Schelz> https://media.discordapp.net/attachments/371759389889003532/910252758190411807/unknown.png |
19:39:56 | FromDiscord | <Schelz> (edit) "i" => "it" |
19:43:27 | FromDiscord | <reilly> There's no distributed Nim build for Raspberry Pis afaik |
19:44:51 | FromDiscord | <reilly> In reply to @Schelz "well lets say i": Go to the "Source archive" section here (https://nim-lang.org/install_unix.html) and follow the instructions |
19:45:04 | FromDiscord | <reilly> You can build the Nim compiler yourself very easily :) |
19:46:40 | FromDiscord | <reilly> If you have any questions, don't hesitate to ask, I do this exact thing to run Nim on my own RPi |
19:48:57 | FromDiscord | <dom96> really need those arm nightlies đ |
19:49:37 | FromDiscord | <Schelz> In reply to @Schelz "": i already did it but want work like i said it gave me this error |
19:50:20 | FromDiscord | <reilly> Oops, forgot how to read, didn't get that bit |
19:50:49 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3FbS |
19:51:08 | FromDiscord | <Schelz> it tried with the pre-built thing, i try know with the source |
19:52:10 | FromDiscord | <reilly> Ah no, I understand what you mean now, gotcha |
19:52:25 | FromDiscord | <reilly> Yes, just compile from source, I guarantee that will work (but may take a minute!) |
20:00:20 | FromDiscord | <Schelz> Ok, while this beauty its installing, I have a question I try to compile a nim file as dll to import it in python using ctypes but when i load it it gives me this error https://media.discordapp.net/attachments/371759389889003532/910258001133322380/unknown.png |
20:00:42 | FromDiscord | <Schelz> its there any args that i missed ? |
20:01:06 | FromDiscord | <Schelz> i used nim c --threads:on --app:lib |
20:01:23 | FromDiscord | <dom96> note that on your RPi you might need to enable swap (otherwise your compilation will likely get killed) |
20:01:29 | FromDiscord | <dom96> (edit) "killed)" => "killed due to running out of memory)" |
20:02:46 | FromDiscord | <Recruit_main707> In reply to @Schelz "Ok, while this beauty": im not sure at all it should work, but you can try defining `DllMain` yourself and compiling with `--noMain` |
20:03:24 | FromDiscord | <Schelz> on or off ? |
20:03:55 | FromDiscord | <Recruit_main707> you dont need to specify on, its on by default |
20:04:35 | FromDiscord | <Recruit_main707> (if you are using .nims files, switch("noMain") works) |
20:04:44 | FromDiscord | <Schelz> its crashing even with --noMain:off |
20:05:19 | FromDiscord | <Recruit_main707> its been a while since i got my hands dirty with dlls and python |
20:06:11 | FromDiscord | <Schelz> cause I tried nimporter and nimpy and nothing worked out |
20:06:57 | FromDiscord | <Schelz> its keep throwing me this error https://media.discordapp.net/attachments/371759389889003532/910259669551972422/unknown.png |
20:13:33 | tk | okay, I think i have managed to package 1.6.0 for voidlinux, so this week at some point hopefully I will find the time to PR that against void-packages |
20:13:56 | tk | (the issue I was having is that 1.6.0 requires csources_v1 not csources) |
20:48:11 | * | vicecea quit (Remote host closed the connection) |
20:48:43 | * | vicecea joined #nim |
20:56:35 | * | neurocyte0132889 quit (Ping timeout: 250 seconds) |
21:19:24 | FromDiscord | <z3nchada> Hello I am looking for the correct channel to post a language specific question. Specifically the best practices for catching exceptions, I am running into an issue where if I try to catch an exception I end up seg-faulting when raising said exception. I want to be sure its not an issue in the way I am writing things before posting an issue. PS I am new to nim but competent in C/Asm and a mixed bag of other languages. |
21:23:42 | FromDiscord | <hotdog> In reply to @z3nchada "Hello I am looking": You can post here |
21:24:18 | FromDiscord | <hotdog> Also have a look at https://nim-lang.org/docs/segfaults.html it may help you |
21:27:20 | FromDiscord | <IsaacPaul> https://nim-lang.org/docs/tut2.html#exceptionsâ”This should also help ^ |
21:28:53 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3Fcc |
21:36:09 | FromDiscord | <z3nchada> In reply to @hotdog "You can post here": Thanks. The segfault happens in removeChunkFromMatrix in alloc.nim; no segfault when I don't catch. Here is an example of how I am using the try catch block. |
21:37:18 | tk | let v = collect: for a, b in combinations(s): a * b where s is a seq[HashSet] and combinations is an inline iterator taking an open_array[T] and returning a tuple[a: T, b: T] |
21:37:37 | tk | according to the docs, this should give me a hash-set which is a union of all the individual results collected together |
21:37:40 | FromDiscord | <z3nchada> sent a code paste, see https://play.nim-lang.org/#ix=3Fcd |
21:37:48 | tk | so it's a union of the intersection of all the things which combinations produced |
21:37:56 | FromDiscord | <Stuffe> Does a custom sort function that always returns 1 guarantee an OrderedTable will always be reversed? Any better way I should use to do this? |
21:38:04 | tk | but in practice I'm getting a single-element seq of a HashSet |
21:38:06 | tk | why? |
21:38:20 | FromDiscord | <z3nchada> (edit) "https://play.nim-lang.org/#ix=3Fcd" => "https://play.nim-lang.org/#ix=3Fce" |
21:39:11 | FromDiscord | <konsumlamm> are you sure that `combinations` yields more than one element? |
21:39:40 | FromDiscord | <z3nchada> sent a code paste, see https://play.nim-lang.org/#ix=3Fcf |
21:40:29 | FromDiscord | <konsumlamm> In reply to @Stuffe "Does a custom sort": i assume you mean a compare function? and wdym by a "reversed ORderedTable"? |
21:41:56 | FromDiscord | <konsumlamm> In reply to @z3nchada "Is there something inherently": nothing about this should be unsafe |
21:42:50 | FromDiscord | <konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3Fcg |
21:45:03 | FromDiscord | <z3nchada> In reply to @konsumlamm "btw, you don't need": gotch-ya. Thanks I just wanted to be very explicit to be sure its a bug considering it all comes from stdlibs. |
21:45:34 | tk | okay, collect is weird |
21:45:36 | tk | let me clean up this testcase |
21:47:01 | FromDiscord | <konsumlamm> In reply to @z3nchada "gotch-ya. Thanks I just": but note that `Exception`s (which includes `Defect`s) should not be catched, use `CatchableError` for that (or, even better, the name of the exception you wanna catch) |
21:47:33 | tk | http://ix.io/3Fci - this kind of explains the issue |
21:48:10 | tk | in fact, it is the crux of the issue |
21:48:33 | tk | does collect inspect the last thing in the AST to see if it's in brackets? |
21:48:43 | FromDiscord | <konsumlamm> (btw, for future reference, it's more useful to provide code via the playground, so that we can directly run it) |
21:48:58 | FromDiscord | <IsaacPaul> In reply to @Stuffe "Does a custom sort": Unless let it specifically states it somewhere I would assume no. It may work today but may change tomorrow if it's not part of a spec. |
21:49:14 | FromDiscord | <konsumlamm> In reply to @tk "does collect inspect the": it does, yes, and colelcts it into a set then iirc |
21:49:28 | tk | and, moreover, is it possible to have THAT feature without having to put brackets at the end? |
21:49:53 | tk | since I like the implicit union feature but actually can't put brackets there (as then it gives me a set of sets) |
21:51:08 | FromDiscord | <konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3Fcl |
21:51:33 | FromDiscord | <z3nchada> In reply to @konsumlamm "but note that `Exception`s": When I use the correct Exception to catch it doesn't segfault. Only with `except Exception as e: ...` If there is not try catch block it just raises the exception, no seg-fault |
21:52:13 | FromDiscord | <Stuffe> In reply to @konsumlamm "i assume you mean": an ordered table has an order to it. I need to reverse that order |
21:52:14 | FromDiscord | <z3nchada> (edit) "seg-fault" => "seg-fault. e.g. `except NamedException: return nil`" |
21:54:57 | FromDiscord | <Stuffe> another crufty way of doing it other than a custom sort function that always returns 1 would be creating an array of the keys, then reverse that and then create a new table |
22:09:29 | FromDiscord | <IsaacPaul> you could use mpairs to build a new table.. though it's weird that you _need_ to reverse the order of the table tho. I would prefer this for piece of mind.. â”â”It looks like sorting starts at the first item and works its way to the last item. It's probably safe (assuming it works), but I can't tell because the sort code is heavily nested and has a ton of single character variables .-. |
22:09:45 | FromDiscord | <IsaacPaul> (edit) "tho. I would prefer this for piece of mind.. â”â”It" => "tho.â”â”It" |
22:51:41 | * | audiophile joined #nim |