<< 16-11-2021 >>

00:03:55tkI present: https://github.com/nim-lang/Nim/issues/19153 - the weird bug I found
00:04:08tkif someone can come up with a better issue title, that would be great.
00:06:18tkhmm, adding more type annotations fixes it
00:06:21tkinteresting
00:09:09FromDiscord<Elegantbeef> `iterator` and `proc` are type classes so that's probably the issue
00:09:18FromDiscord<Elegantbeef> It doesnt fill them in and it errors due to it
00:09:56FromDiscord<Elegantbeef> It should be `iterator(): int` and `proc f(): iterator(): int`
00:10:59tkah, 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:08tkElegantbeef: http://ix.io/3F6N this prints <> and crashes (because there is no such file)
00:13:20tkI assume filename should be getting captured there but isn't
00:13:39tkif you put the entire iterator INSIDE the func you get what I wanted to begin with
00:17:41tk(which I think may be what as_closure does but I didn't investigate it)
00:18:19FromDiscord<Elegantbeef> Yea that's pretty much what it does afaict
00:18:19FromDiscord<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:00FromDiscord<brainproxy> (edit) "current/parent" => "a source's directory / its parent"
00:24:40tkhttps://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:21FromDiscord<d-static> Any books for nim?
01:17:19*audiophile_ joined #nim
01:18:52FromDiscord<Elegantbeef> There is "nim in action" and http://ssalewski.de/nimprogramming.html though the latter isnt a published book
01:36:32FromDiscord<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:15NimEventerNew 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:58FromDiscord<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:35FromDiscord<Elegantbeef> Yep static typing is fantastic
02:30:51FromDiscord<evoalg> I'm impressed that I didn't even need to compile it to catch the error
02:31:24FromDiscord<Elegantbeef> Well it 'compiled' 😛
02:32:09FromDiscord<evoalg> the nvim syntax highlighting changed straight away though, it wasn't compiling it right?
02:32:34FromDiscord<Elegantbeef> Well the file is semantically checked so somewhat compiled
02:32:59FromDiscord<evoalg> ah I see what you mean
02:33:00FromDiscord<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:31FromDiscord<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:26FromDiscord<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:55FromDiscord<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:11FromDiscord<evoalg> true!
02:50:41FromDiscord<Elegantbeef> There is the caveat of "your swap might be large enough" but if you want performance you've lost the battle
02:50:55FromDiscord<evoalg> makes sense
02:52:38FromDiscord<evoalg> but what about doing `for line in "myBigFile.txt".lines:` ? is that mem efficient?
02:53:52FromDiscord<Elegantbeef> It seems to read each line to a string and yields it so probably
02:54:01FromDiscord<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:32FromDiscord<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:02FromDiscord<brainproxy> sent a long message, see http://ix.io/3F7r
04:07:58*xet7 joined #nim
04:09:44FromDiscord<Elegantbeef> I dont think there is a drop down, but yea this has been a thing for a while
04:11:48FromDiscord<brainproxy> đŸ€Šâ€â™‚ïž
05:42:01*audiophile_ quit (Quit: Default Quit Message)
06:10:01FromDiscord<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:28FromDiscord<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:00FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8c
09:00:21FromDiscord<Rika> What do you mean
09:01:05FromDiscord<Rika> Also I don’t know why you’re returning a proc either
09:05:15FromDiscord<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:38FromDiscord<Rika> I mean I don’t know what reasons you’re doing certain things for
09:06:14FromDiscord<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:02FromDiscord<Zoom> `f` is a regular procedure, it can take arguments, why use macro?
09:14:59FromDiscord<Rika> I’m not sure what you mean it’s probably just an understanding issue
09:15:08FromDiscord<Rika> If you just want to add an argument then that’s all you need to do
09:15:37FromDiscord<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:54FromDiscord<Zoom> Well, thank you very much, this helps a lot. I would never have come to this solution without you.↔(@Rika)
09:24:29FromDiscord<Rika> If you’re being sarcastic then I do not know what you mean
09:24:37FromDiscord<Rika> And you are not helping
09:24:57FromDiscord<Rika> So feel free to ask again once you want to help
09:25:59FromDiscord<Zoom> Do you want me to walk you through the code in question? What is it you don't understand?
09:26:29FromDiscord<Rika> I don’t care
09:27:15PMunch@Zoom, had a look through the log and I'm not entirely certain what you want to do either
09:27:24FromDiscord<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:36FromDiscord<Rika> No shit
09:27:52PMunch@Rika, no need for that..
09:28:07FromDiscord<Elegantbeef> Well the confrontation either way is less than needed
09:28:10FromDiscord<Rika> I can’t be nice to some fuckhead who thinks I can read minds
09:28:21FromDiscord<Zoom> If it's so clear to you, why did you ask me why a few minutes ago?↔(@Rika)
09:28:26PMunch@Rika, again, no need for language like that
09:28:40FromDiscord<Elegantbeef> Eh to be fair pmunch zoom was very sarcastic
09:28:51FromDiscord<Elegantbeef> Both need to go sit in time out and think about what they did
09:29:09FromDiscord<Rika> You help him
09:29:10PMunchTrue, but just because someone else is rude doesn't mean you have to
09:29:19PMunchI'm trying..
09:29:32FromDiscord<Rika> Of course but it’s not realistic to take everything every time
09:29:39FromDiscord<Rika> There’s gonna be a limit to each person
09:29:49FromDiscord<Schelz> Cry ?
09:30:08FromDiscord<Rika> What do you mean now
09:30:21PMunchBut instead of being rude back just go do something else *shrugs*
09:30:33FromDiscord<Elegantbeef> I swear if the next comment isnt about the problem at hand i'll finally snap!
09:30:38PMunchAnyway @Zoom, what are you trying to do
09:30:55PMunchYou have a procedure that returns a procedure which returns an iterator
09:31:24PMunchBut your procedure is called iterFactory, so why not just return an iter+
09:31:32PMunch?*
09:31:46FromDiscord<Rika> Perhaps some other code takes in the proc that returns an iterator
09:31:49FromDiscord<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:56FromDiscord<Rika> And the factory is just adhoc uh
09:31:59FromDiscord<Rika> What’s it called
09:32:07PMunchNo one does, but lets get back to your problem
09:32:15FromDiscord<Rika> I don’t know the think they do with functions in Haskell
09:32:19FromDiscord<Elegantbeef> The pissing contest is very much not needed
09:32:20FromDiscord<Rika> Partial functions something something
09:33:02FromDiscord<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:07FromDiscord<Rika> Well what now, do you want help or do you want to continue shitting on me
09:33:38FromDiscord<Rika> We don’t know what your whole code is so we can’t infer what you want exactly
09:34:41PMunch@Zoom, but what are you actually trying to do?
09:35:08PMunch@Rika, again with the harsh language. Please try to keep it civil
09:35:14FromDiscord<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:30FromDiscord<Rika> What now? I didn’t call him anything, I’m asking if he wants to keep on being rude to me
09:35:38PMunchAnd @Zoom, stop engaging with him and tell me what you're trying to achieve so I can actually help you..
09:35:43FromDiscord<Elegantbeef> The easiest solution is to just drop it
09:35:52FromDiscord<Elegantbeef> Go paint a happy tree or something
09:36:00PMunchExactly!
09:36:04FromDiscord<Rika> I’m not even trying to be rude this time
09:36:14FromDiscord<Rika> I’m not even mad anymore what now
09:36:40PMunchWell saying to someone that they're shitting on you isn't particularly polite. And it's certainly not Nim-related..
09:36:56FromDiscord<Rika> As if it’s polite to be the one doing it
09:37:12FromDiscord<Rika> Whatever
09:37:27PMunch@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:31FromDiscord<Rika> I really don’t get what’s up with you guys
09:38:02PMunch@Rika, we're just trying to help someone in the Nim channel asking Nim questions
09:38:08FromDiscord<Elegantbeef> Nothing much, how bout you?
09:38:22FromDiscord<Rika> Apparently y’all think I’m still mad or whatever
09:38:33PMunchNope, you don't seem mad now :)
09:38:36FromDiscord<Rika> What now, am I the next one to be banned
09:38:42FromDiscord<Rika> Can’t wait
09:38:42PMunchNot at all
09:38:56FromDiscord<Rika> Prolly should do it preemptively myself
09:39:05PMunchWe don't ban people for having emotions
09:39:06FromDiscord<Schelz> Lame
09:39:18FromDiscord<Elegantbeef> So that iterator factory huh
09:39:20PMunchI know it says bot over my name, but I'm actually also human :P
09:39:33FromDiscord<Elegantbeef> That's yet to be decided pmunch
09:39:37FromDiscord<Rika> Again I assume it’s just some sort of partial function application
09:39:47FromDiscord<Schelz> How did you got the not tag ?
09:39:53FromDiscord<Schelz> (edit) "not" => "bot"
09:39:54PMunchHaha :P Just don't spill liquid around me and we're good @Elegantbeef
09:40:01FromDiscord<Rika> He makes a factory to get a function with no parameters but now he just wants the function straight
09:40:09FromDiscord<Rika> It’s an assumption
09:40:13FromDiscord<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:15PMunch@Schelz, because I'm on IRC and my messages are relayed to Discord
09:41:56FromDiscord<Zoom> If you return a straight iterator Nim treats it as one on invocation
09:42:11FromDiscord<Rika> Hm I don’t remember that being the case
09:43:19PMunchSomething like this? https://play.nim-lang.org/#ix=3F8j
09:44:10FromDiscord<Rika> TFW can’t type code because on mobile
09:44:24PMunchNot with that attitude! :P
09:44:30FromDiscord<Rika> Also from last time I recall you can use closure iterator directly on for loops
09:44:40PMunchI've multiple times used the playground to type up Nim on mobile :P
09:44:48PMunchIt's a massive pain in the ass, but it works
09:44:53FromDiscord<Rika> It takes significant time
09:44:55FromDiscord<Rika> Yeah
09:46:04PMunchYou can do this can't you? https://play.nim-lang.org/#ix=3F8k
09:46:23FromDiscord<Rika> Yes
09:46:29FromDiscord<Elegantbeef> Cmon pmunch quit being a sadomasochist with that iterator definition https://play.nim-lang.org/#ix=3F8l
09:46:31FromDiscord<Rika> That’s what I was just making lol
09:46:37FromDiscord<Rika> Again, time consuming
09:46:56PMunchhttps://play.nim-lang.org/#ix=3F8m
09:47:23PMunch@Elegantbeef, what was wrong with my iterator definition?
09:47:37FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8n
09:47:50PMunchToo many parenthesis for you @Elegantbeef=
09:48:00FromDiscord<Rika> Oh
09:48:12FromDiscord<Rika> That’s because the it iterator is treated as an inline one I believe
09:48:24FromDiscord<Rika> You need to put the closure pragma on it too
09:48:26FromDiscord<Rika> Then it should work
09:48:35FromDiscord<Elegantbeef> Nope
09:48:43FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F8o
09:48:45FromDiscord<Rika> So what is the issue
09:49:10FromDiscord<Rika> I just compiled what you sent and got an error lmfao
09:49:31FromDiscord<Rika> But it’s unrelated
09:49:33FromDiscord<Elegantbeef> I dropped the `myIter()` like a drongo
09:50:00FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8q
09:50:06PMunchI don't see the problem @Zoom, seems to work just fine: https://play.nim-lang.org/#ix=3F8p
09:50:18FromDiscord<Rika> Maybe it’s to do with the consume parameter it’s type
09:50:36FromDiscord<Rika> Though it’s an implicit generic so
09:50:38FromDiscord<Rika> It should work
09:50:39PMunch@Zoom, well because you're taking an iterator() not an iterator(): int
09:50:49FromDiscord<Elegantbeef> Nope
09:50:55FromDiscord<Elegantbeef> `iterator` is a built in typeclass
09:50:56FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F8r
09:50:57FromDiscord<Zoom> Doesn't matter↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
09:50:57FromDiscord<Rika> Nope to who me?
09:50:58FromDiscord<Elegantbeef> Works just fine
09:51:07FromDiscord<Rika> Yeah it should just work
09:51:15FromDiscord<Rika> Do you see any possible areas for errors?
09:51:21FromDiscord<Rika> Might be unrelated to this part of code
09:52:08FromDiscord<Elegantbeef> Yea i dont know
09:52:40PMunch@Zoom, with a generic return type it works just fine: https://play.nim-lang.org/#ix=3F8s
09:53:02PMunchOf course that requires your generic type to have a `+` procedure defined
09:53:15FromDiscord<Elegantbeef> Pmunch really making it complex 😀
09:53:38PMunchOh wait, is `iterator` an implicit generic?
09:53:43FromDiscord<Elegantbeef> `iterator` is a built in type class! It matches for any closure iterator!
09:53:44FromDiscord<Rika> Jesus that’s large
09:53:44PMunchI thought you just said it wasn't :P
09:53:48PMunchAaah
09:53:50FromDiscord<Rika> See I told you
09:53:57FromDiscord<Rika> That’s why I asked if it was towards me
09:54:27FromDiscord<Elegantbeef> I mean i thought it was clear from the follow up
09:54:39PMunchI was busy writing my own code :P
09:54:40FromDiscord<Elegantbeef> Anyway i have to walk through 30cm of snow to take out garbage
09:54:55PMunchAll our snow rained away two days ago :(
09:55:14*pro joined #nim
09:55:21FromDiscord<Rika> I’m thankful it’s not snowing yet
09:55:34FromDiscord<Rika> Not ready for metre deep snow yet
09:55:44FromDiscord<Rika> (Exaggeration)
09:55:47FromDiscord<Zoom> Ok, so one of the issues I was having is that `()` matter
09:55:51FromDiscord<Rika> I see
09:55:56FromDiscord<Rika> That makes sense yeah
09:56:10FromDiscord<Rika> Adding the parentheses makes it no longer an implicit generic I assume
09:56:13FromDiscord<Zoom> `iterator (): int{.closure.}` or `int`
09:59:50FromDiscord<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:44FromDiscord<Zoom> He wanted to instantiate a factory and use it repeatedly.
10:00:58FromDiscord<Zoom> That's why it returns a proc
10:01:14FromDiscord<Elegantbeef> I feel like the solution is just to make an object on instantiation that holds a single value, and the defaults
10:01:40FromDiscord<Rika> I honestly still don’t get the full picture of what he wants
10:01:42FromDiscord<Zoom> My initial question was simply how to extract the function from the body of that factory
10:01:51FromDiscord<Rika> Extract in what way?
10:02:01FromDiscord<Zoom> It doesn't matter! We discuss a piece of code in isolation.↔(@Rika)
10:02:08FromDiscord<Rika> Okay understood
10:02:21FromDiscord<Rika> What do you exactly mean when you say extract
10:02:54FromDiscord<Zoom> Extract our of the enclosing procedure.
10:02:56tkI basically want new_iterator = functools.partial(iterator, params...)
10:03:13tkwhere new_iterator can be used to instantiate and isn't already instantiated
10:03:31FromDiscord<Rika> You call the function and store the return type, now you have “fl
10:03:36FromDiscord<Rika> “F”, sorry typo
10:04:28FromDiscord<Rika> If you want to make iterators you then call f and use the return type
10:04:43FromDiscord<Rika> Being mindful that the returned iterators are stateful
10:11:34FromDiscord<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:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3F8K
10:11:46FromDiscord<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:10FromDiscord<Elegantbeef> It's not instantiating a new `it` on the next invocation of `a`
10:12:12FromDiscord<Rika> Beef because you’re calling f again which is returning a fresh iterator?
10:12:14FromDiscord<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:27FromDiscord<Elegantbeef> That's what you'd expect but no the iterator state is fucked
10:12:38FromDiscord<Rika> God someone replace the matrix bridge
10:12:41FromDiscord<Rika> It’s so fucked
10:13:09FromDiscord<Rika> Beef sounds like a bug now time for you to do what you always do
10:13:09FromDiscord<Elegantbeef> Ah nvm you're probably right
10:13:10FromDiscord<Rika> Half kidding
10:13:16FromDiscord<Rika> Oh lol
10:15:08PMunch@Zoom, so you want something like this? https://play.nim-lang.org/#ix=3F8L
10:15:31PMunchCreate a factory with arguments, then call the factory without an argument and get fresh iterators of the same kind every time
10:15:55FromDiscord<Rika> Yeah I think the factory naming is kinda misleading
10:16:12FromDiscord<Rika> “Iterator factory” is actually an “iterator factory factory”
10:16:13FromDiscord<Zoom> I already got that in the first example↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
10:16:30tkit's not an iterator factory, it's an iterator factory factory
10:16:36tkthe iterator factory is what it returns
10:16:46PMunchNo one buys hammers any more
10:17:05FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F8O hmmm does this meet any criteria?
10:17:20FromDiscord<Elegantbeef> Using the iterator inline instantiates a new iterator every tick which causes badnews
10:18:33FromDiscord<Rika> Yup that’s what I said TK
10:18:39FromDiscord<Rika> PMunch nice
10:18:40tkat least it's not a an abstract singleton proxy factory bean
10:18:46FromDiscord<Rika> Welcome to Java hell I guess
10:19:33tkah yea, the iterator thing, I found that bug yesterday (where it loops forever0
10:19:36tkI was confused too
10:19:40PMunchI'm still not sure why the last code snippet I shared isn't exactly what you want?
10:19:40FromDiscord<Rika> It’s not really a bug
10:19:44tkI wasn't sure if I had done something wrong or not
10:19:47FromDiscord<Rika> It’s just a confusing idea
10:19:51FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8P
10:19:57FromDiscord<Rika> ?
10:20:11FromDiscord<Zoom> Now I want to take `f` out somehow↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
10:20:14FromDiscord<Rika> You just changed the name? Or am I being blind
10:20:17FromDiscord<Elegantbeef> Yea tk i just threw a bunch of guesses at it until it stopped running
10:20:19tkWell yes, the abstract singleton proxy factory bean^W^W^W^Witerator factory factory IS what I want
10:20:26tkit's exactly what I came up with
10:20:32PMunch`result = proc (): iterator (): int`
10:20:33tkbut the problem is that it's clunky
10:20:39PMunchInstead of proc f and then return f
10:21:00PMunchtk, well it's a clunky concept :P
10:21:04tkis it really?
10:21:07tkit's not clunky in python
10:21:09PMunchBut you could always make a template or something out of it
10:21:10FromDiscord<Rika> ~~you can even omit the result = part~~
10:21:23tkright, the problem is having to call 50 times
10:21:28tkthe syntax still confuses me
10:21:28PMunchtk, I mean it's a clunky OO pattern :P
10:21:31tknot really
10:21:32FromDiscord<Elegantbeef> tk i'm going to see if i can abstract this any using a macro tomorrow
10:21:42tkthis has nothing to do with OO, it could be an entirely functional concept
10:21:43PMunchWe typically don't do that in Nim
10:21:55FromDiscord<Elegantbeef> I do like the idea of a resetable closure
10:21:57tkin fact, I could write this in scheme with fewer parentheses
10:22:00FromDiscord<Rika> Beef you mean you’re gonna make a partial function applicator?
10:22:08tk(actually, don't quote me on that, I'm sure there will be more parentheses)
10:22:09FromDiscord<Elegantbeef> I dont speak french
10:22:12tkbut it's just partial function application
10:22:12FromDiscord<Rika> Don’t we have that already
10:22:15FromDiscord<Rika> Yes
10:22:17FromDiscord<Zoom> Could you show it to me on the example I provided please?↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
10:22:23tkand if iterators were just "functions" then it would work
10:22:26tkbut it doesn't
10:22:32PMunch@Zoom, which one?
10:22:43tknow I get why iterators aren't "just functionsℱ" but it doesn't mean that this should be entirely applicable to them
10:23:06PMunchHmm, someone has to have written a partial function application library in Nim
10:23:15FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8Q
10:23:17PMunchIt's just a little bit of macro magic I believe
10:23:34FromDiscord<Elegantbeef> I wager as such, but i still dont speak french 😛
10:23:35FromDiscord<Zoom> Can you do it without macro?
10:24:02tkZoom: I don't think you have to specify {.closure.} there explicitly, it's implicit since you're returning it to begin with
10:24:06PMunch@Zoom: https://play.nim-lang.org/#ix=3F8S
10:24:11tkat least that's how I justify it in my head
10:24:19PMunchYes, it should be implicit
10:24:25FromDiscord<Elegantbeef> Indeed tk, iterators in typedefs are implicitly closures
10:24:26FromDiscord<Rika> Beef you better speak french
10:24:37FromDiscord<Elegantbeef> Nah i'm a terrible Canadian
10:24:50FromDiscord<Zoom> ? The function body is still inside.↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
10:24:55FromDiscord<Rika> Nah I’m pretty sure only those in Quebec actually speak french
10:25:16tkI 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:19FromDiscord<Elegantbeef> Quebec, NB, Alberta have sizeable francophones
10:25:35FromDiscord<Rika> I’m not from Canada I don’t know what NB means
10:25:44FromDiscord<Rika> New Banana
10:25:53FromDiscord<Elegantbeef> New Brunswick it's a province
10:26:09FromDiscord<Rika> Hey I got one word right
10:26:25tkthat's a 50% success rate, otherwise known as a majority
10:26:31FromDiscord<Elegantbeef> Well the one bug isnt that weird
10:26:37FromDiscord<Rika> No a majority is 50%+1
10:26:52FromDiscord<Elegantbeef> Nim has multiple bugs using typeclasses as return types since not one bothers to check if that's the case
10:27:16tkElegantbeef: 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:22tkso it's kind of still weird
10:27:33tkbut sure, it's a weird corner case
10:27:43FromDiscord<Elegantbeef> No i mean the using built in typeclass as return type error
10:28:03tkyeah, that's also the one I meant
10:28:06tkthis is the other one https://github.com/nim-lang/Nim/issues/19154
10:28:07FromDiscord<Rika> What’s that error?
10:28:11PMunch@Zoom, wait you don't want the function body inside your function?
10:28:18tkRika: https://github.com/nim-lang/Nim/issues/19153
10:28:21PMunchThat's where function bodies are supposed to be..
10:28:33FromDiscord<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:02FromDiscord<Elegantbeef> Araq says that typeclasses shouldnt be usable there or for variable instantiations, so it probably should be done
10:29:45FromDiscord<Zoom> Yep, that's literally what my first question today was.↔(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
10:30:10FromDiscord<Rika> So that’s what you mean by extract
.
10:31:02tkNo, that's not what I meant by extract
10:31:08tkor what zoom meant I don't thinl
10:31:10FromDiscord<Rika> No I mean zoom
10:31:17FromDiscord<Rika> Really?
10:31:21tkzoom meant what I meant because I think he's on the same page as me
10:31:35tkin any case
10:31:44tkI need to get back to work.
10:31:48FromDiscord<Zoom> You're overestimating me đŸ˜…â†”(<@709044657232936960_tk=5b=49=52=43=5d>)
10:31:49FromDiscord<Rika> See you
10:32:15tkah, so THAT's what the weird number thing is
10:32:23tk(<@709044657232936960_tk=5b=49=52=43=5d>) - it's a reference to an IRC user
10:32:27tkhorrific
10:32:37FromDiscord<Rika> No a reference to a discord user
10:32:46tkBut I don't exist on discord.
10:32:53FromDiscord<Rika> You do technically
10:33:00tkWow, I feel mildly violated.
10:33:07tkFor real though, I have to go.
10:33:13FromDiscord<Rika> It’s irc <> discord <> matrix
10:34:09PMunchYeah those numbers aren't great..
10:34:23PMunchIt also means I don't get pinged when you reply to me..
10:34:33PMunchBecause that weird ID string doesn't contain my name
10:34:45FromDiscord<Elegantbeef> I mean who wants to talk to you anyway 😛
10:34:59PMunchJokes on you, you're talking to me right now!
10:35:18FromDiscord<Elegantbeef> This cant be so!
10:35:23FromDiscord<Elegantbeef> I now go to sleep, so jokes on you
10:35:44PMunchGood night
10:37:19FromDiscord<Rika> Imagine sleeping
10:37:27FromDiscord<Rika> I just down my 5th cup of espresso
10:43:27FromDiscord<Zoom> Anyway, Rika might have been somewhat correct in his evaluation. I'm dumb.
10:44:43FromDiscord<Rika> Well let’s just say everything that just happened was a massive lump of miscommunication
10:44:46FromDiscord<Rika> Sorry
10:44:54FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3F8W
10:47:55PMunchI guess you could also make a template to easy the usage of this pattern
10:48:01FromDiscord<Zoom> I'm sorry too for being too mordant.↔(@Rika)
10:48:08FromDiscord<Rika> What does mordant mean
10:48:14FromDiscord<Rika> Lol okay wait I’ll search it
10:48:27FromDiscord<Rika> Oh
10:51:33FromDiscord<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:07PMunchMaybe something like this: https://play.nim-lang.org/#ix=3F8Y
10:52:59PMunchA tiny bit of macro magic and you can even turn that into a pragma
10:53:18PMunchBut that's left as an exercise for the reader
10:53:26FromDiscord<Zoom> That looks nice
10:54:56FromDiscord<retkid> hety
10:54:57FromDiscord<retkid> (edit) "hety" => "hey"
10:55:02PMunchHello
10:55:11FromDiscord<retkid> it appears that writeFile is having problems writing a large amount of data
10:55:24FromDiscord<retkid> ie 8000 images in a json format with 260 mbs of t ext
10:55:26FromDiscord<retkid> (edit) "t ext" => "text"
10:55:38FromDiscord<retkid> is this expected behaviour
10:56:06PMunchDefine problems
10:56:09FromDiscord<Rika> I mean that’s a lot of data
10:56:11FromDiscord<retkid> i should probably put those images into base 96 anyway
10:56:25FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/910121117434396692/unknown.png
10:56:33PMunchYou should probably not store those images as JSON :P
10:56:41FromDiscord<retkid> wellllll
10:56:56FromDiscord<retkid> its raw image data
10:56:57FromDiscord<retkid> (edit) "its raw image data ... " added "as a string"
10:57:01FromDiscord<retkid> in a class
10:57:38PMunchSo save that as an image and put references to them in your JSON?
10:57:50PMunchJSON really isn't a good choice for binary data
10:58:32FromDiscord<retkid> but its more convenient to just query the server and get sent the data
10:58:50FromDiscord<retkid> im gonna encode it
10:58:57FromDiscord<retkid> it works fine with like 100 images
10:59:06FromDiscord<retkid> (edit) "100" => "1000"
11:00:33PMunchBut you're going to be sending so much more data than you actually need to send :S
11:00:59FromDiscord<Rika> Is there a reason you use json
11:01:09FromDiscord<retkid> just because marshal
11:01:18FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=
11:03:54FromDiscord<Rika> There are better formats you can use that are already implemented, just in other libraries
11:03:58PMunchHmm, 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:11PMunchUp until that point memory usage is completely static
11:04:16FromDiscord<Rika> Debugger time I assume
11:04:57PMunchI mean I'm not even sure what to debug..
11:05:13PMunchIt's just killed by zsh for consuming a lot of memory
11:05:48PMunchIt also jumps from 12.5% CPU to 100% CPU
11:05:55PMunchRight before crashing
11:07:47FromDiscord<Rika> Yeah maybe step through the program or so
11:08:00FromDiscord<Rika> Wait I don’t think that would work well
11:08:47FromDiscord<retkid> In reply to @Rika "There are better formats": can you give me an example for a better format for seralization
11:08:50FromDiscord<retkid> (edit) "seralization" => "serialization"
11:09:19FromDiscord<retkid> i upgraded from Marshal but apparently↔ im still not a cool kid
11:09:23FromDiscord<retkid> (edit) "apparently↔" => "apparently"
11:09:47FromDiscord<enthus1ast> @retkid\: maybe msgpack is more efficient and quite the same convince
11:10:07FromDiscord<enthus1ast> But idk how well it packs binary data
11:10:14FromDiscord<retkid> I've added a base64 encoder
11:10:17FromDiscord<retkid> i thought it would be a pain
11:10:22FromDiscord<retkid> (edit) "i thought it would be a pain ... " added "but it seems really simple"
11:10:27FromDiscord<retkid> literally juse
11:10:28FromDiscord<retkid> (edit) "juse" => "just"
11:10:30FromDiscord<retkid> encode()
11:10:37FromDiscord<Rika> Message pack protocol buffers CBOR BSON etc
11:11:04FromDiscord<Rika> Is there a reason these images aren’t just hosted as images and have to be in json?
11:11:34FromDiscord<retkid> I think it'll just be more convenient and simple on the frontend
11:11:51FromDiscord<Rika> Convenient I don’t think so
11:16:58FromDiscord<retkid> In reply to @Rika "Convenient I don’t think": it'll literally be decodeURIComponent(escape(window.atob(img)));
11:17:07PMunchRemember you'd have to demarshal and rebuild the images in JS on the grontend..
11:17:08FromDiscord<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:21FromDiscord<retkid> In reply to @PMunch "Remember you'd have to": thats already done
11:17:22PMunchInstead of just creating an image tag with a url
11:17:26FromDiscord<Rika> And if you just hosted it normally you wouldn’t need to do any of this demarshalling
11:17:34PMunchAnd let the browser handle the heavy lifting
11:17:59PMunchYour site would be pretty slow if it's loading all that JavaScript and demarshalling it into images is my guess
11:18:32FromDiscord<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:45FromDiscord<retkid> but
11:18:49FromDiscord<retkid> maybe im just paranoid
11:18:55FromDiscord<retkid> probably doesn't matter
11:18:57FromDiscord<Rika> You can cache it on your backend
11:31:43FromDiscord<PutoPie> how do i install nim on raspberry pi 4? I've downloaded nim-1.7.1-linux_arm64.tar.xz
11:35:18FromDiscord<Zoom> Why not use the one your disto package manager offers?↔(@PutoPie)
11:36:32PMunchThose tend to be quite out of date..
11:37:47FromDiscord<Zoom> But then you can compile choosenim
11:44:15PMunchAh, so you want to use the built-in package to build choosenim then install Nim through choosenim and remove the distro package?
11:44:22FromDiscord<hmmm> boys if nim -v says Windows: i386 it measn I have the 32bit version of nim?
11:44:52FromDiscord<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:57FromDiscord<Schelz> For example ik that it would something like this http://user:[email protected]/Example
11:46:18FromDiscord<Schelz> (edit) "http://user:[email protected]/Example" => "http:/user:[email protected]/Example"
11:53:55FromDiscord<Yardanico> In reply to @Schelz "I have a question": that's usually basic authentication
11:53:56FromDiscord<hotdog> In reply to @Schelz "I have a question": You need to set a header
11:54:06FromDiscord<Yardanico> it's not in httpclient but it's pretty simple to do just by setting a header with correct values
11:54:16FromDiscord<hotdog> Yeah ^
11:54:40FromDiscord<hotdog> It'll be something like `Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==`
11:54:53FromDiscord<hotdog> With the correct details of course
11:55:13FromDiscord<Yardanico> yeah, @Schelz , Basic auth is just "login:password" base64-encoded
11:57:44FromDiscord<Rika> ~~please don’t use in prod~~
11:58:20FromDiscord<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:15probut if you put nginx with tls infront ?
12:00:31FromDiscord<Yardanico> well I specifically said "not https"
12:00:41FromDiscord<Yardanico> with https headers are encrypted so only you and the server see them
12:04:09FromDiscord<Schelz> So i have to done it from nginx ?
12:04:22FromDiscord<Yardanico> @Schelz nonono, if you just need basic auth you just set a header with correct values
12:04:44FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3F9e
12:05:07FromDiscord<Schelz> Perfect example thx
12:05:15FromDiscord<Yardanico> as others said above, basic authentication is just an `Authentication` header with `Basic ` and base64-encoded login<colon>password
12:05:34FromDiscord<Schelz> Got it know
12:05:41FromDiscord<Schelz> (edit) "know" => "now"
12:06:02*supakeen quit (Quit: WeeChat 3.3)
12:06:11FromDiscord<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:41FromDiscord<hmmm> hmm how can I tell choosenim I want the 64bit
12:17:32FromDiscord<PutoPie> sent a code paste, see https://play.nim-lang.org/#ix=3F9h
12:18:36FromDiscord<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:43FromDiscord<Yardanico> probably nim in your distro is very old
12:20:32FromDiscord<PutoPie> its 0.19.4 đŸ€·â€â™‚ïž
12:20:34FromDiscord<Zoom> I've recently compiled choosenim on for 32bit on debian bullseye without issues.
12:20:40FromDiscord<Zoom> Yep, that's old
12:21:53FromDiscord<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:05FromDiscord<Yardanico> or download compiled nim 1.6 if you really want to compile choosenim yourself
12:22:10FromDiscord<Zoom> He's on arm, there's no binaries
12:22:11FromDiscord<Yardanico> also don't forget to uninstall your distro-installed nim
12:22:13FromDiscord<Yardanico> In reply to @Zoom "He's on arm, there's": there are
12:23:12FromDiscord<Yardanico> https://github.com/nim-lang/nightlies/releases/tag/latest-version-1-6
12:23:20FromDiscord<Yardanico> despite the "nightlies" name it's the build from the 1.6 branch
12:23:28FromDiscord<Yardanico> and there are binaries for amd64 and armv7l
12:24:06FromDiscord<hmmm> hmm apparently choosenim checks your installed mingw version and just decides "yea dude you will be fine with the 32bit"
12:24:36FromDiscord<hmmm> so I just went and grabbed the 64zip the primitive way and ran finish.exe
12:24:37FromDiscord<Yardanico> In reply to @Yardanico "and there are binaries": i meant arm64 and armv7l (if we're talking about arm)
12:24:37FromDiscord<Zoom> Wait, there aren't choosenim binaries.↔(@Yardanico)
12:24:51FromDiscord<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:57FromDiscord<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:01PMunchYou can also unzip and to `choosenim .` IIRC
12:25:13FromDiscord<Yardanico> In reply to @PutoPie "yes i downloaded .tar.xz": yes
12:25:32NimEventerNew thread by JPLRouge: I made a publication, a job with MSGSHM, see https://forum.nim-lang.org/t/8633
12:25:33FromDiscord<Yardanico> you need unpack the archive and add the "bin" folder inside of it to your PATH
12:30:04FromDiscord<Zoom> I like how JPLRouge skips full stops in this post and then just puts a bunch of them to compensate.
12:30:41FromDiscord<PutoPie> In reply to @Yardanico "you need unpack the": i'll copy the contents of nim-1.7.1/bin to /bin?
12:30:49FromDiscord<Yardanico> nonono
12:31:08FromDiscord<Yardanico> you just uncompress the whole nim folder, move it anywhere you like, and add nim/bin folder to your PATH
12:31:31FromDiscord<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:23FromDiscord<PutoPie> oh I get it now, i will have to add to evironment variable, thanks
12:35:23PMunchWell 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:36PMunch@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:26FromDiscord<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:58FromDiscord<hmmm> that's a very intriguing question lol
13:20:58FromDiscord<dom96> But yeah. We should make choosenim ask
13:21:02FromDiscord<hmmm> I don't know!
13:21:08FromDiscord<hmmm> 😊
13:21:15FromDiscord<dom96> But then you run risk of mismatches
13:21:46FromDiscord<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:58FromDiscord<hmmm> choosenim should do the same maybe
13:22:57FromDiscord<dom96> You can run into a broken install though.
13:23:11FromDiscord<dom96> If your 32 bit gcc is in front of the installed one
13:23:31FromDiscord<hmmm> hmm, I guess I will need to clean the house a bit
13:24:35FromDiscord<hmmm> don't wtf is happening with my compilers tbh I have 2 mingw, 1 winbuilds, 1 msys64 laying around
13:24:49FromDiscord<hmmm> I guess it all works out? lol
13:25:09FromDiscord<Rika> Lmao
13:32:06*rockcavera quit (Remote host closed the connection)
13:37:29PMunchHmm, I'm still not entirely sure what's "legal" and not when it comes to ARC and threading..
13:42:51FromDiscord<dom96> Stop. You have committed an offence against the ARC of Nim
13:43:15FromDiscord<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:41PMunch@Clonkk, oh I've got significantly more "sinister" plans :P
13:46:56PMunchTrying "steal" an iterator from one thread to another
13:47:06PMunchWithout the first thread being involved at all
13:47:23PMunchJust copying the ref to the iterator from one thread to the other
14:01:32FromDiscord<tandy> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: honorable mention in the readme https://gitlab.com/tandy1000/listenbrainz-nim
14:04:41FromDiscord<Yardanico> https://github.com/vanyle/SublimeNim
14:04:57FromDiscord<Yardanico> seems like a plugin based (at least syntax) on nimlime for st4
14:05:11FromDiscord<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:48PMunchHaha, that's a weird line to take :P
14:09:26FromDiscord<Yardanico> i mean it's nothing bad, it's up to everyone to decide how they want their repos to be :)
14:09:31FromDiscord<Yardanico> but yeah, kinda unusual
14:10:38FromDiscord<Recruit_main707> I guess they have plans already made
14:14:21FromDiscord<Clonkk> Well it must not be ready yet, I tried it it doesn't highlight syntax↔(@Yardanico)
14:14:28FromDiscord<Yardanico> huh? that's weird
14:14:35FromDiscord<Yardanico> it does highlight in the screenshot shown
14:16:35FromDiscord<Clonkk> Ah interesting
14:16:45FromDiscord<Clonkk> I had to dsiable NeoVintageous to get it to work
14:16:50FromDiscord<Clonkk> Then once I re-enabled it
14:16:54FromDiscord<Clonkk> It's fine
14:28:03*arkurious joined #nim
15:14:15tkOkay, 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:40tk(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:12FromDiscord<Clonkk> sent a code paste, see https://play.nim-lang.org/#ix=3FaG
15:18:38FromDiscord<Clonkk> Ah nvm, you just added "without reading the entire things" ^^
15:57:31FromDiscord<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:25FromDiscord<IsaacPaul> This looks like it does exactly what you want to do.. but.. I was wrong before so đŸ€·â€â™‚ïž 😂
16:03:03tkyes, this looks promising
16:04:28NimEventerNew 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:38FromDiscord<Schelz> sent a long message, see http://ix.io/3FaZ
16:17:01FromDiscord<Schelz> (edit) "http://ix.io/3FaZ" => "http://ix.io/3Fb0"
16:17:47FromDiscord<Schelz> (edit) "http://ix.io/3Fb0" => "http://ix.io/3Fb1"
16:18:20FromDiscord<Schelz> (edit) "http://ix.io/3Fb1" => "http://ix.io/3Fb2"
16:18:27FromDiscord<Schelz> (edit) "http://ix.io/3Fb2" => "https://paste.rs/sZF"
16:18:52tkincidentally, the FromDiscord bot could just use ix.io's edit feature to edit an existing paste
16:19:50FromDiscord<enthus1ast> @Schelz\: what crashes and how (what error?)
16:20:34FromDiscord<Schelz> i compile it with nim c Test.nim
16:21:12FromDiscord<Schelz> its not printing any error at the compiling only when run the exe bump up console and close instantly
16:21:55FromDiscord<enthus1ast> Run it from a terminal so that it won't close immediately
16:21:56FromDiscord<Schelz> it could be from an arg ?
16:22:35FromDiscord<Schelz> the request was printed so fast that the console dont even had time to print it
16:22:43FromDiscord<Schelz> (edit) "print" => "see"
16:22:48FromDiscord<dom96> yeah, you need to run cmd.exe manually
16:22:50FromDiscord<Schelz> got it working from terminal
16:22:53FromDiscord<dom96> and then run your program from it
16:22:55FromDiscord<Schelz> thx
16:23:05FromDiscord<dom96> you can also use `nim c -r test.nim` to compile and run
16:23:28FromDiscord<Schelz> i forgot about that -r 😆
16:24:23*PMunch quit (Quit: leaving)
16:29:24FromDiscord<hmmm> very suspect
16:30:21*audiophile_ joined #nim
16:31:21FromDiscord<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:42FromDiscord<Recruit_main707> may you post the exact commands?
16:38:57FromDiscord<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:29FromDiscord<Recruit_main707> thats why i think you must be doing somrthing wrong when calling it
16:41:04FromDiscord<hmmm> I mean it's a path 🧐
16:43:09FromDiscord<Rika> thats how cwd works?
16:44:43FromDiscord<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:54FromDiscord<Rika> at least that's the common behavior
16:45:36*audiophile_ quit (Quit: Default Quit Message)
16:46:36FromDiscord<hmmm> the path is fine if I change .exe to .nim it opens vscode with the file
16:47:27FromDiscord<Rika> i dont understand what the issue is now, more context is needed
16:49:53FromDiscord<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:19mikkosounds like you just have the wrong working directory
16:50:27mikkohttps://superuser.com/questions/396394/how-do-i-set-an-executables-working-directory-via-the-command-line-prior-to-ex
16:51:04FromDiscord<hmmm> hmm
16:51:18FromDiscord<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:01FromDiscord<hmmm> oh I see you need to tell terminal the working directory because he doesn't know
17:06:18FromDiscord<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:24FromDiscord<hmmm> windows is weird as hell
17:06:31FromDiscord<hmmm> mikko :nim1:
17:13:36*u0_a185 quit (Quit: WeeChat 3.0.1)
17:45:04NimEventerNew 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:55FromDiscord<Schelz> Why is nimpy not working to install ? https://media.discordapp.net/attachments/371759389889003532/910237763369041991/unknown.png
18:51:23NimEventerNew 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:26NimEventerNew 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:05FromDiscord<hotdog> In reply to @Schelz "Why is nimpy not": What version of Nim?
19:06:12FromDiscord<hotdog> And what's the contents of that file?
19:06:38FromDiscord<Schelz> sent a long message, see http://ix.io/3FbL
19:07:02FromDiscord<Schelz> the version i think its v0.9.0
19:07:09FromDiscord<Schelz> im on rpi 4 so....
19:16:43tkis the 1.6 tag buildable?
19:17:10FromDiscord<dom96> In reply to @Schelz "the version i think": that's a very old version
19:21:53FromDiscord<Schelz> i just typed sudo apt install nim
19:22:01FromDiscord<Schelz> thats the version i got 😆
19:23:33FromDiscord<Schelz> try to get from the nim page the tar and install it manually
19:23:39FromDiscord<Schelz> (edit)
19:23:55FromDiscord<reilly> In reply to @Schelz "i just typed sudo": Yes, sadly the apt version is quite out of date
19:25:32FromDiscord<Rika> Quite?
19:25:56FromDiscord<Rika> You’re saying that as if 0.9 isn’t over 15 versions old
19:26:36FromDiscord<reilly> Very out of date.
19:26:37FromDiscord<Rika> I don’t even think there is online documentation for 0.9
19:28:08FromDiscord<Schelz> Hahaa lol
19:35:36FromDiscord<dom96> https://nim-lang.org/blog/2012/09/23/version-090-released.html
19:35:38FromDiscord<dom96> 2021!
19:35:43FromDiscord<dom96> (edit) "2021!" => "2012!"
19:36:28FromDiscord<dom96> "Closures have been implemented." those were the days
19:36:29FromDiscord<Schelz> you actually find it lol
19:39:23FromDiscord<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:30FromDiscord<Schelz> https://media.discordapp.net/attachments/371759389889003532/910252758190411807/unknown.png
19:39:56FromDiscord<Schelz> (edit) "i" => "it"
19:43:27FromDiscord<reilly> There's no distributed Nim build for Raspberry Pis afaik
19:44:51FromDiscord<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:04FromDiscord<reilly> You can build the Nim compiler yourself very easily :)
19:46:40FromDiscord<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:57FromDiscord<dom96> really need those arm nightlies 🙂
19:49:37FromDiscord<Schelz> In reply to @Schelz "": i already did it but want work like i said it gave me this error
19:50:20FromDiscord<reilly> Oops, forgot how to read, didn't get that bit
19:50:49FromDiscord<reilly> sent a code paste, see https://play.nim-lang.org/#ix=3FbS
19:51:08FromDiscord<Schelz> it tried with the pre-built thing, i try know with the source
19:52:10FromDiscord<reilly> Ah no, I understand what you mean now, gotcha
19:52:25FromDiscord<reilly> Yes, just compile from source, I guarantee that will work (but may take a minute!)
20:00:20FromDiscord<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:42FromDiscord<Schelz> its there any args that i missed ?
20:01:06FromDiscord<Schelz> i used nim c --threads:on --app:lib
20:01:23FromDiscord<dom96> note that on your RPi you might need to enable swap (otherwise your compilation will likely get killed)
20:01:29FromDiscord<dom96> (edit) "killed)" => "killed due to running out of memory)"
20:02:46FromDiscord<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:24FromDiscord<Schelz> on or off ?
20:03:55FromDiscord<Recruit_main707> you dont need to specify on, its on by default
20:04:35FromDiscord<Recruit_main707> (if you are using .nims files, switch("noMain") works)
20:04:44FromDiscord<Schelz> its crashing even with --noMain:off
20:05:19FromDiscord<Recruit_main707> its been a while since i got my hands dirty with dlls and python
20:06:11FromDiscord<Schelz> cause I tried nimporter and nimpy and nothing worked out
20:06:57FromDiscord<Schelz> its keep throwing me this error https://media.discordapp.net/attachments/371759389889003532/910259669551972422/unknown.png
20:13:33tkokay, 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:56tk(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:24FromDiscord<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:42FromDiscord<hotdog> In reply to @z3nchada "Hello I am looking": You can post here
21:24:18FromDiscord<hotdog> Also have a look at https://nim-lang.org/docs/segfaults.html it may help you
21:27:20FromDiscord<IsaacPaul> https://nim-lang.org/docs/tut2.html#exceptions↔This should also help ^
21:28:53FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3Fcc
21:36:09FromDiscord<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:18tklet 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:37tkaccording to the docs, this should give me a hash-set which is a union of all the individual results collected together
21:37:40FromDiscord<z3nchada> sent a code paste, see https://play.nim-lang.org/#ix=3Fcd
21:37:48tkso it's a union of the intersection of all the things which combinations produced
21:37:56FromDiscord<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:04tkbut in practice I'm getting a single-element seq of a HashSet
21:38:06tkwhy?
21:38:20FromDiscord<z3nchada> (edit) "https://play.nim-lang.org/#ix=3Fcd" => "https://play.nim-lang.org/#ix=3Fce"
21:39:11FromDiscord<konsumlamm> are you sure that `combinations` yields more than one element?
21:39:40FromDiscord<z3nchada> sent a code paste, see https://play.nim-lang.org/#ix=3Fcf
21:40:29FromDiscord<konsumlamm> In reply to @Stuffe "Does a custom sort": i assume you mean a compare function? and wdym by a "reversed ORderedTable"?
21:41:56FromDiscord<konsumlamm> In reply to @z3nchada "Is there something inherently": nothing about this should be unsafe
21:42:50FromDiscord<konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3Fcg
21:45:03FromDiscord<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:34tkokay, collect is weird
21:45:36tklet me clean up this testcase
21:47:01FromDiscord<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:33tkhttp://ix.io/3Fci - this kind of explains the issue
21:48:10tkin fact, it is the crux of the issue
21:48:33tkdoes collect inspect the last thing in the AST to see if it's in brackets?
21:48:43FromDiscord<konsumlamm> (btw, for future reference, it's more useful to provide code via the playground, so that we can directly run it)
21:48:58FromDiscord<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:14FromDiscord<konsumlamm> In reply to @tk "does collect inspect the": it does, yes, and colelcts it into a set then iirc
21:49:28tkand, moreover, is it possible to have THAT feature without having to put brackets at the end?
21:49:53tksince I like the implicit union feature but actually can't put brackets there (as then it gives me a set of sets)
21:51:08FromDiscord<konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3Fcl
21:51:33FromDiscord<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:13FromDiscord<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:14FromDiscord<z3nchada> (edit) "seg-fault" => "seg-fault. e.g. `except NamedException: return nil`"
21:54:57FromDiscord<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:29FromDiscord<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:45FromDiscord<IsaacPaul> (edit) "tho. I would prefer this for piece of mind.. ↔↔It" => "tho.↔↔It"
22:51:41*audiophile joined #nim