<< 01-12-2021 >>

00:00:03*dv^_^ quit (*.net *.split)
00:00:03*supakeen quit (*.net *.split)
00:00:03*lucerne quit (*.net *.split)
00:00:03*kayabaNerve quit (*.net *.split)
00:00:53*Colt quit (Remote host closed the connection)
00:01:54*kayabaNerve joined #nim
00:02:07*kayabaNerve quit (Remote host closed the connection)
00:02:14*Colt joined #nim
00:02:23*supakeen joined #nim
00:02:34*kayabaNerve joined #nim
00:02:43*dv^_^ joined #nim
00:04:45*nrds quit (Ping timeout: 256 seconds)
00:23:00*rockcavera quit (Remote host closed the connection)
00:26:31FromDiscord<sOkam!> Is there any std library that can send raw inputs from code to the OS?↵Like sending specific mouse movements or keystrokes↵Or does that need an external lib?
00:29:32FromDiscord<Elegantbeef> There is not something like that in the stdlib that i know of, so yea you'd need an external library
00:29:50FromDiscord<Elegantbeef> SDL2 i believe can give you that abillity in a cross platform way, though could be wrong
00:30:03FromDiscord<Elegantbeef> You can also just use system calls of course
00:32:52FromDiscord<Elegantbeef> On unix i wager you can just write directly to the mouse device, windows probably has an API specifically for this
00:35:27FromDiscord<creikey> In reply to @sOkam! "Is there any std": For Linux uinput is low level but is very capable https://www.kernel.org/doc/html/v4.12/input/uinput.html
00:43:59FromDiscord<sOkam!> In reply to @creikey "For Linux uinput is": I'm super new to os interfacing and programming↵How would one go about communicating with uinput?↵_(im on lnx, so its what I'd use, since I can't find a ready made lib atm)_
00:44:15FromDiscord<creikey> In reply to @sOkam! "I'm super new to": You call the functions in c
00:44:25FromDiscord<creikey> There's an example on that page
00:44:32FromDiscord<Elegantbeef> I mean you can do it in Nim
00:44:41FromDiscord<sOkam!> In reply to @creikey "You call the functions": i meant in nim. i can read the page just fine
00:44:44FromDiscord<Elegantbeef> The fun part is there is this library i found that wraps the code and is MIT licensed https://github.com/cjxgm/hiddle/blob/e407976bdfdefda397467fb94a7b22bd03924c4e/src/input.nim
00:45:07FromDiscord<Elegantbeef> So you can probably copy that module assuming you properly abide by MIT when you share it 😀
00:46:00FromDiscord<Elegantbeef> There is also https://github.com/cjxgm/hiddle/blob/e407976bdfdefda397467fb94a7b22bd03924c4e/src/uinput.nim
00:46:18FromDiscord<sOkam!> :IF: i share it 😈 ↵But yeah, joke aside, tysm
00:46:36FromDiscord<creikey> In reply to @Elegantbeef "There is also https://github.com/cjxgm/hiddle/blob/": This doesn't seem like it has all the uinput enums
00:46:48FromDiscord<creikey> I remember it has a lot of stuff
00:47:08FromDiscord<Elegantbeef> Hey it's a start for a `uinput` package 😛
00:48:30FromDiscord<Elegantbeef> I really need to be more productive cause i'm have tempted to run c2nim on this and nimify uinput \:d
00:48:40FromDiscord<Elegantbeef> half tempted even
00:51:21FromDiscord<Elegantbeef> I guess there is also https://github.com/luked99/libevdev.nim
00:55:25FromDiscord<sOkam!> In reply to @Elegantbeef "I really need to": How hard is it to make a wrapper with the automated tools like that one (or the other, cant remember the name)?↵Is it error prone, or what's the issue? Why are they not the norm, an people go for something more manual?
00:55:47FromDiscord<Elegantbeef> Well there are also things like futhark
00:56:20FromDiscord<Elegantbeef> More manual stuff is better imo since it's more idiomatic
00:56:32FromDiscord<Elegantbeef> You can always of course do the tool converted with a wrapping on top
00:56:50FromDiscord<sOkam!> ic
00:57:32FromDiscord<Elegantbeef> It does very much depend on what you're after
00:58:09FromDiscord<Elegantbeef> If you want to just use code then stuff like futhark is nice, but if you want have use Nim features and make it a bit more idiomatic you'll want to use something like c2nim then manually annotate it
01:00:49FromDiscord<Elegantbeef> For an instance of something you might do, C tends to use integers for bitsets, but Nim has proper bitset support so you might replace usages of that integer with `set[YourEnum]`
01:03:21FromDiscord<Elegantbeef> Another thing is using `distinct T` instead of just `T` in cases that there should be type safety (GPIO pins in a microcontroller stdlib for example)
01:09:21*nrds joined #nim
01:10:58nrds<Prestige99> Yeah the internet cut out
01:11:09nrds<sorcerer99> ah i see senior
01:13:11FromDiscord<Elegantbeef> I never though prestige was that old, but the more you learn
01:14:08nrds<sorcerer99> his social security number is in roman numerals
01:18:22nrds<Prestige99> Heh
01:45:32FromDiscord<creikey> In reply to @nrds "<sorcerer> his social security": My social security number opsec is horrible am I doomed
01:57:18FromDiscord<evoalg> there is c2nim?
01:57:28FromDiscord<Elegantbeef> There is
01:57:54FromDiscord<Rika> it cant convert everything though
01:58:20FromDiscord<Elegantbeef> Yea we're not going to get a tool converted linux kernel
01:58:50FromDiscord<evoalg> hehe ... still, nice to hear!
01:59:03FromDiscord<Rika> itll get you lets say maybe 90 or 95% of the way tho
01:59:29FromDiscord<evoalg> nice
02:21:02*arkurious quit (Quit: Leaving)
02:24:43FromDiscord<exelotl> hey I have a weird Nim doc issue...
02:25:08FromDiscord<exelotl> https://natu.exelo.tl/waitstates.html↵does anyone know why the "Source" links on the page don't work? The URL is valid, and you can right-click -> "open in new tab" to open it. But clicking it does nothing
02:29:19FromDiscord<Elegantbeef> `target="_blank"` is the culprit it seems\`
02:31:58FromDiscord<exelotl> weird...
02:33:07FromDiscord<Elegantbeef> Yea i dont have a degree in webology so cannot help any, maybe there is a way to override it
02:43:40*rockcavera joined #nim
02:43:40*rockcavera quit (Changing host)
02:43:41*rockcavera joined #nim
02:47:00FromDiscord<exelotl> here's the culprit: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/sandbox
02:47:28FromDiscord<exelotl> I can't change this because it's enforced by Sourcehut Pages ;_;
03:46:40*noeontheend joined #nim
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:12:18FromDiscord<impbox [ftsf]> works when i middle click or ctrl click
04:24:21*nrds quit (Remote host closed the connection)
04:24:36*nrds joined #nim
04:33:48FromDiscord<the cws came hme> that's the same as right click open in new tab
04:36:10*sagax quit (Quit: Konversation terminated!)
04:38:15*_c quit (Ping timeout: 250 seconds)
04:38:58*noeontheend quit (Quit: noeontheend)
04:39:11*noeontheend joined #nim
04:39:28*_c joined #nim
04:39:52*_c is now known as Guest1971
05:43:35FromDiscord<recreation> hello, anyone mind giving me a lil help
05:44:32FromDiscord<Elegantbeef> If you just ask it'll find it's way
05:46:00FromDiscord<recreation> sent a code paste, see https://play.nim-lang.org/#ix=3GDC
05:46:30FromDiscord<recreation> (edit) "https://play.nim-lang.org/#ix=3GDC" => "https://play.nim-lang.org/#ix=3GDD"
05:46:40FromDiscord<recreation> `integers.txt` is a text file with one integer per line
05:46:49FromDiscord<Elegantbeef> split lines might have an extra value
05:47:35FromDiscord<Elegantbeef> you dont parse integers so you're comparing characters
05:50:06FromDiscord<Rika> Beef are you okay
05:50:08FromDiscord<recreation> In reply to @Elegantbeef "you dont parse integers": ahhh that was the issue, i solved it now
05:50:24FromDiscord<Elegantbeef> What do you mean eika?
05:50:26FromDiscord<Elegantbeef> rika\
05:50:35FromDiscord<recreation> thank you for the help!
05:50:55FromDiscord<Rika> That doesn’t seem to be the issue
05:51:02FromDiscord<Elegantbeef> Which?
05:51:06FromDiscord<Rika> Is it not because of -1 and then again ..<
05:51:25FromDiscord<Rika> Double subtraction hence the 1680
05:51:27FromDiscord<Elegantbeef> Oh that probably is it
05:51:34FromDiscord<Elegantbeef> I read them backwards
05:51:40FromDiscord<recreation> it magically resolved itself when i added `.map(parseInt)`, so idk why e.e
05:51:51FromDiscord<Rika> Then you’re comparing strings?
05:52:52FromDiscord<Rika> Do we really have a string comparison operator
05:52:53FromDiscord<recreation> ye, i assumed the comparison will remain the same even if i dont parse them to int
05:53:04FromDiscord<Rika> Not necessarily I assume
05:53:20FromDiscord<Elegantbeef> The comparison is just length iirc
05:53:25FromDiscord<Rika> Isn’t this the lexical vs numerical comparison issue
05:53:49FromDiscord<Elegantbeef> It is lexical
05:53:52FromDiscord<Elegantbeef> So it is fine
05:54:04FromDiscord<recreation> sent a code paste, see https://play.nim-lang.org/#ix=3GDF
05:54:07FromDiscord<Elegantbeef> `var`
05:54:11FromDiscord<Elegantbeef> `let` is immutable
05:54:35FromDiscord<recreation> ahhh thats mbad haha, i hopped into it without reading the docs
05:54:41FromDiscord<recreation> thanks again
06:07:50*rockcavera quit (Remote host closed the connection)
06:16:29*energizer joined #nim
06:16:34*energizer left #nim (Leaving)
06:26:47FromDiscord<evoalg> @recreation one way to read in the lines and convert to ints (like the python program does) is to do:↵ `let data = readFile("integers.txt").splitLines().map(parseInt)`
06:27:58FromDiscord<Rika> That’s what he did ye
06:27:59FromDiscord<Rika> Yes
06:28:06FromDiscord<Rika> In reply to @recreation "it magically resolved itself": Here
06:28:22FromDiscord<evoalg> ahhh I missed that!
06:28:27FromDiscord<Elegantbeef> AoC is really going to encourage me to make ore iterator utilities
06:28:45FromDiscord<evoalg> Nice1
06:28:45FromDiscord<Rika> Miner iterators
06:29:28FromDiscord<recreation> e.e i thought i hid it well that that was aoc
06:29:39FromDiscord<Elegantbeef> Not even close 😛
06:29:45FromDiscord<Elegantbeef> I knew first glance it was aoc
06:29:55FromDiscord<recreation> haha i guess it was really obvious, finding the increase
06:30:13FromDiscord<recreation> i got bored after i finished it in python so i tried to rewrite it in nim
06:30:23FromDiscord<Rika> Any questions asked during AoC should be assumed to be about AoC lol
06:30:40FromDiscord<evoalg> lol true
06:30:51FromDiscord<Rika> I guess especially from someone new
06:34:41FromDiscord<evoalg> @recreation you can find some other nim solutions that you can compare yours to (after you've finished writing yours), which may help see what's possible in Nim, and also ask in here for tips before that 😉
06:36:53FromDiscord<recreation> ye, i was trying to hack something together with `sum` and `zip` in nim and use one of those `block` thingies but failed terribly haha
06:37:40FromDiscord<recreation> i find nim pretty cool, plus i am on my holidays and learning it sounds fun
06:45:11FromDiscord<pyautogui> @recreation minor thing, generally I do believe inc(x) is prefered to x += 1 in Nim.
06:49:39FromDiscord<Rika> Use one or the other. Determine yourself which is more appropriate
07:27:10FromDiscord<pyautogui> Thanks. Good to know there is not a prefered standard.
07:54:23*Guest1971 quit (Quit: leaving)
08:02:33FromDiscord<evoalg> oh zip in Nim ... `zip(seq1, seq2)` works but not `zip(seq1, seq2, seq3)`
08:03:02Amun-RaI use inc to increment by one += otherwise
08:25:29*neurocyte0132889 joined #nim
08:25:29*neurocyte0132889 quit (Changing host)
08:25:30*neurocyte0132889 joined #nim
08:43:13FromDiscord<@MaskRay:matrix.org> So I indeed run into the issue for my WIP ELF linker\: https://github.com/nim-lang/Nim/issues/19205 (`[arc] of operation segfaults for a ptr object containing traced reference`)
08:46:17FromDiscord<Elegantbeef> Hmm seems something doesnt check if the field is `nil` before a dereference i guess
08:48:45FromDiscord<Elegantbeef> Ah yes it seems `obj.isNil or` added to line 233 of `arc.nim` might be all that's needed
08:49:18FromDiscord<Elegantbeef> Hmm that could be wrong
08:50:43FromDiscord<Elegantbeef> The issue is actually the inheritance check it seems
08:50:49FromDiscord<Clonkk> If you have a nimble file with multiple binary is it possible to different options for each binary when using `nimble build`
08:50:52*advesperacit joined #nim
08:52:51FromDiscord<Elegantbeef> probably can get away with `yourNimFile.config.nims`
08:57:15FromDiscord<Clonkk> I assume you meant `yourNimFile.nim.cfg` ?
08:58:18FromDiscord<Elegantbeef> Which ever you prefer
08:58:27FromDiscord<Elegantbeef> Or is it `yourNimFile.nims`
08:58:32FromDiscord<Elegantbeef> I think it's that 😀
08:59:13FromDiscord<Clonkk> .config.nims works as wel ?
08:59:16FromDiscord<Clonkk> Ah yeah
08:59:24FromDiscord<Clonkk> So many config file options
09:02:36FromDiscord<Elegantbeef> config.nims might not work
09:02:44FromDiscord<Elegantbeef> That's probably just a fever dream of mine
09:03:09FromDiscord<Clonkk> yourfile.nims works and the compiler documentation mentions yourfile.nim.cfg
09:03:33FromDiscord<Clonkk> yourfile.config.nims does not work
09:04:56FromDiscord<Elegantbeef> yea `config.nims` is used at the root of the project but would apply to everything
09:05:07FromDiscord<Elegantbeef> but `name.config.nims` is me being dumb
09:05:30FromDiscord<Clonkk> Eh I don't blame you, it's all very confusing
09:05:37FromDiscord<Clonkk> You can feel the legacy
09:06:09FromDiscord<Clonkk> I remember reading on the forums that .nims were then new recommanded way I think ?
09:06:18FromDiscord<Rika> pretty much afaik
09:06:28FromDiscord<Rika> but also afaik you can do things in cfg that you cant on nims
09:06:52FromDiscord<Clonkk> Such as ?↵(@Rika)
09:07:16FromDiscord<Rika> im not so sure anymore but i think i remember it being mentioned here a while back
09:07:27FromDiscord<Rika> i guess it doesnt matter until you hit the issue though
09:11:51FromDiscord<Elegantbeef> There was an issue that you couldnt use config for setting release flags but that applied to both
09:13:39FromDiscord<Clonkk> I think that's fixed nowadays ?
09:14:14FromDiscord<Clonkk> Or are we still limited to danger / Release being on the command line
09:14:55FromDiscord<Elegantbeef> It's been fixed iirc
09:22:26advesperacitWhen using testament, is there a way to set `cmd` to apply to all tests instead of repeating it in each test file?
09:25:14advesperacitIt appears that I need `cmd: "nim c -r $options $file"` for third party imports to not break with "cannot open file"
09:29:51*PMunch joined #nim
10:08:56FromDiscord<tbrekalo> Is there a nicer way of writting this? https://media.discordapp.net/attachments/371759389889003532/915544985313632266/unknown.png
10:12:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3oQs
10:12:37FromDiscord<Elegantbeef> https://github.com/beef331/slicerator
10:12:39FromDiscord<Elegantbeef> Shameless plug
10:12:39nrds<R2D299> itHub: 7"A simple iterator library to enable more efficient iterators"
10:12:54FromDiscord<Elegantbeef> Otherwise yea you've got to do that factory method
10:13:13FromDiscord<tbrekalo> So what's this doing? https://media.discordapp.net/attachments/371759389889003532/915546068509409291/unknown.png
10:14:15FromDiscord<Elegantbeef> I realize now you arent actually saving state
10:15:04FromDiscord<tbrekalo> in the second example I create a copy of a closure iterator and just call it?
10:16:08FromDiscord<Elegantbeef> well you instantiate it
10:16:48FromDiscord<tbrekalo> thanks
10:20:21*Vladar joined #nim
10:25:14FromDiscord<hmmm> our std xml facilities are imo very good but I'm missing the xpath facilities I had in python 🤔
10:25:19FromDiscord<hmmm> rika pls add them
10:25:26FromDiscord<hmmm> you have 1 hour 🧐
10:28:45FromDiscord<Rika> wtf
10:28:59FromDiscord<Rika> u do it
10:37:37FromDiscord<hmmm> I do it? I do not have the skills, you do it!
10:38:08FromDiscord<Rika> get the skills then
10:38:15FromDiscord<hmmm> it's not easy!
10:38:56FromDiscord<amadan> @hmmm is something like this what you are looking for?↵https://github.com/OpenSystemsLab/q.nim
10:38:57nrds<R2D299> itHub: 7"Query HTML/XML elements using a CSS3 or jQuery-like selector syntax"
10:41:04FromDiscord<hmmm> hmm it's not clear to me if it does what I want amadan. What I want is this https://docs.python.org/3/library/xml.etree.elementtree.html#elementtree-xpath
10:41:24FromDiscord<Rika> its close
10:41:39FromDiscord<hmmm> xpath is super comfy for people like me that suck at xml and stuff
10:55:03PMunchGotta laugh a bit when I see things like this in C# code `[HttpPost("transfertask")] // POST /api/transfertask`
10:55:36PMunchAnd know that that comment explaining what this line does is almost exactly the code you'd use in Nim for the same result :)
10:55:51PMunchJust lowercase that POST and you're good
10:56:25PMunchOf course completely dropping the next line `public async Task<IActionResult> NewTransferTask()`
11:00:58FromDiscord<tbrekalo> is there something as python `reduce` from functools in vanilla nim?
11:01:50PMunchfoldl?
11:03:36PMunch@tbrekalo ^
11:12:51FromDiscord<tbrekalo> In reply to @PMunch "foldl?": but it takes a sequence as the argument; I just want to pass an iterator object
11:14:42FromDiscord<Rika> need 3rd party library then
11:15:28PMunchOr convert it to a seq first, although that's not the most efficient
11:16:08PMunchYou have `foldl` in iterutils: https://github.com/def-/nim-iterutils/blob/master/src/iterutils.nim#L171
11:16:33FromDiscord<tbrekalo> thanks guys 🙂
11:16:39PMunchBut that takes a proc..
11:17:07FromDiscord<Rika> isnt that normal
11:17:13PMunchSure
11:17:23PMunchBut `foldl` in sequtils takes untyped
11:17:33PMunchAnd exposes the variables `a` and `b`
11:21:42FromDiscord<apahl> sent a long message, see http://ix.io/3BaQ
11:27:32FromDiscord<Rika> its not always true
11:27:54FromDiscord<Rika> ah
11:27:55FromDiscord<Rika> wait
11:28:02FromDiscord<Rika> of course the first element is the same address
11:28:08FromDiscord<Rika> ah wait no okay i get what you mean
11:40:18PMunchThey aren't always copied
11:41:43PMunchNim will pass any type by address if it is beneficial. The compiler doesn't allow you to change it anyways (as long as it's not `var`) so it's safe to do so. However if you take a seq argument and then do `var x = mySeqArg` and modify `x` then `x` will be a copy of `mySeqArg`.
11:44:16FromDiscord<apahl> Yes, that makes sense.
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:31*supakeen joined #nim
12:27:41*kobi joined #nim
12:29:41FromDiscord<Rika> actually you dont even need to modify x
12:29:45FromDiscord<Rika> as long as x is var, its already copied
12:34:02PMunchWell, there is a change it gets optimised out isn't it?
12:34:28PMunchOr will it always copy if you do `var x = mySeqArg; echo x[0]`?
12:40:14NimEventerNew thread by Miran: This Month with Nim: November, see https://forum.nim-lang.org/t/8667
12:45:23PMunch@Yardanico, how's that Sciter testing going?
12:45:44FromDiscord<Yardanico> i missed it - did you reply with how you got it to compile?
12:46:08FromDiscord<Yardanico> the char16_t thing
12:47:16FromDiscord<apahl> In reply to @Rika "as long as x": If you change `let` to `var` in my example above, the address of the first element still stays the same, so not copied, I would say.
12:47:49FromDiscord<Yardanico> In reply to @apahl "If you change `let`": as you figured out, Nim can optimize the copy if it sees that it's safe, but unsafeAddr (as well as addr), is, well, unsafe :)
12:47:57FromDiscord<Yardanico> so this code just relies on internal implementation details
12:47:59FromDiscord<Yardanico> and is not guaranteed to work
12:48:36FromDiscord<apahl> Yes, I do not want to do anything with the address, I just was interested whether the sequence was copied or not.
12:49:43FromDiscord<apahl> And to be clear: I think it is very good, that the sequence does not unnecessarily get copied.
12:52:40PMunchYardanico, sorry I missed that
12:52:44PMunchWhat was the problem?
12:53:34FromDiscord<Yardanico> Error: unknown type name 'char16_t' and I forgot how to solve it in futhark :)
12:55:31FromDiscord<Yardanico> that comes from opir, so I guess it actually comes from clang?
12:55:40PMunchYup
12:55:54PMunchCould you share what you have so far?
12:56:06FromDiscord<Yardanico> in nimterop I had to do "-TBOOL=bool,char16_t=cushort,UINT=cuint,SBOOL=bool" btw
12:56:15FromDiscord<Yardanico> @PMunch just this:
12:56:23FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GEK
12:57:39FromDiscord<Rika> In reply to @apahl "If you change `let`": thats not what i mean
12:58:08FromDiscord<Rika> if you make another var in the function, `x`, then let will have the same addr but var will not
12:59:50kobihi
13:01:47PMunchHello
13:02:03kobihow are you PMunch
13:02:21PMunchWell, I'm sick, but otherwise fine
13:03:17kobiah, that's too bad
13:04:07kobiwell, u know, i believe that when some gets sick, their karma is pushed out of their body, then they feel sickness and suffer, but afterwards they are healthier than before
13:04:39*src joined #nim
13:05:03FromDiscord<apahl> In reply to @Rika "if you make another": Ah, ok. True. Thanks for the clarification.
13:05:13kobiso all of it is good, anyway
13:06:16NimEventerNew thread by Argl: Making a distinct type slightly less distinct, see https://forum.nim-lang.org/t/8668
13:08:04PMunchkobi healthier than before sounds good, currently I can't even taste or smell anything..
13:10:02kobisorry to hear that, man
13:11:30kobiin israel we have a saying, something like: a trouble for many is a fool's comfort
13:12:16kobiit's like, if i told u, that i am currently unemployed. would it make u feel better?
13:12:24kobi:-)
13:13:13kobiToday I am attempting to understand async in Nim ...
13:13:38FromDiscord<Rika> any problems with undersatnding?
13:13:50PMunch@Yardanico, I also get that error, but it seems to build fine
13:14:25FromDiscord<Yardanico> huh, weird, opir does "SIGSEGV: Illegal storage access. (Attempt to read from nil?)" and futhark can't parse that obviously :)
13:14:28FromDiscord<Yardanico> for me
13:14:32FromDiscord<Yardanico> after showing that error
13:15:06kobiRika: hi Rika, can i ask in a private msg?
13:15:24FromDiscord<Yardanico> yes but you'll have to join discord :)
13:15:40FromDiscord<Yardanico> i mean even to have the possibility to pm to rika, idk if he'll agree
13:15:43kobihaven't irced in a long time
13:16:42PMunchHmm, do you have the latest version, and Nim 1.6.0?
13:17:22FromDiscord<Yardanico> i have devel nim and latest futhark (0.3.1)
13:17:49PMunchkobi, of course that wouldn't make me feel better. Now I'm sick and sad that you're unemployed..
13:18:16kobiapparently, you're not a fool, then :-)
13:18:41kobiit's ok, i am trying to start a side business
13:19:01PMunchOh cool, what do you want to do?
13:19:04kobistill in feasability checking stage
13:19:10FromDiscord<Yardanico> @PMunch after I enabled stacktraces Nim says that SIGSEGV happens on line "var cursor = getTranslationUnitCursor(unit)" for me
13:19:41kobiwell, writing portable apps for lin,win, android
13:19:48FromDiscord<Yardanico> and with `echo` i can indeed confirm that it stops on that call
13:19:56kobitechnologically it is feasable. financially i don't know yet
13:20:03FromDiscord<Yardanico> that said, I have the latest clang 13.0.0 too
13:20:19FromDiscord<Yardanico> are you sure it should actually continue just fine after showing an error?
13:21:25kobiI am trying to create a general purpose lib for managing async requests, by making them feel very single threaded... think queues.
13:22:39kobiwriting the manager is familiar to me, but I am missing a crucial bit. how to work with async and I want to basically wrap what the user passes
13:23:07kobiso that when the future succeeds it'll be added to a success queue, if failed to a failed queue, if timeout ...
13:23:41kobiso it's like a template where in between the user code i can add this code to "notify" the manager of the state.
13:25:35kobistill not working though.
13:25:48kobiAre there examples for async code out there?
13:26:51PMunchYardanico, some errors are fine. It should error out on critical ones
13:27:07PMunchHmm, I have clang 12.0.1 apparently
13:27:26PMunchBut I wonder if I might've modified the clang Nim library at some point
13:27:29PMunchJust a sec
13:28:10PMunchkobi there should be quite a few examples of async code out there
13:28:26PMunchHave you seen my article on async and the tutorial page on it?
13:28:37PMunchOr even the Nim in Action chapter on async?
13:35:27PMunchSeems I didn't do anything to the clang library
13:36:06*sagax joined #nim
13:36:08PMunchYardanico, could you try to install Futhark again?
13:36:47kobiah ok i think i got it
13:36:56FromDiscord<Yardanico> hm, I tried it a few times, still doesn't work
13:37:01FromDiscord<Yardanico> is it supposed to change anything @PMunch ?
13:37:16PMunchNah, just wanted to make sure you where on the latest version
13:39:43PMunchBit surprised that I don't have 13.0.0 yet though
13:40:33PMunchAh, just haven't updated my system
13:40:38PMunchI'll try with 13.0.0
13:43:15*rockcavera joined #nim
13:43:15*rockcavera quit (Changing host)
13:43:15*rockcavera joined #nim
13:44:37kobihow do I add a timeout to an async request?
13:45:06kobiI see addTimer in asyncdispatch but not sure how to use
13:46:33FromDiscord<Yardanico> In reply to @kobi "how do I add": not sure what you mean
13:46:38FromDiscord<Yardanico> there's withTimeout
13:46:47FromDiscord<Yardanico> but it might not be what you want - https://nim-lang.org/docs/asyncdispatch.html#withTimeout%2CFuture%5BT%5D%2Cint
13:48:11kobihmm
13:48:38kobiI forgot i can search github for code samples in advanced search
13:52:27*noeontheend quit (Ping timeout: 252 seconds)
13:52:57kobiwhy does addTimer needs an AsyncFD?
13:57:18PMunchYardanico, hmm with the latest clang version I get the same results
14:02:14PMunch@Yardanico, here is what it ends up creating for me by the way: http://ix.io/3GFg
14:02:26PMunchYou could try that for now
14:02:51FromDiscord<dom96> anything that takes an AsyncFD is a low-level proc, you likely don't want to use it
14:09:54FromDiscord<dithpri> So, I've been fiddling around with concepts, and I'd appreciate any explanation as to why this doesn't work (and how to make it work):↵https://play.nim-lang.org/#ix=3GFh
14:12:34kobiok i think i've got it.
14:12:53kobithanks dom96
14:13:45*arkurious joined #nim
14:20:34PMunchYardanico, it's kinda hard to figure out what's wrong when it works for me..
14:22:26PMunchThis is my sciter.nim file by the way: http://ix.io/3GFp
14:22:58PMunchsciter-js-sdk is git cloned from here: https://github.com/c-smile/sciter-js-sdk
14:23:01nrds<R2D299> itHub: 7"Sciter.JS - Sciter but with QuickJS on board instead of my TIScript"
14:27:48PMunchOh hey, I appear to have my taste back
14:28:45PMunchCompiled with: nim c --maxLoopIterationsVM:100000000 sciter.nim
14:29:49FromDiscord<hmmm> is there somewhere a discord / telegram bot that for x activity will buld a mini calendar of people available dates for something? Like dinner with friends activity you tell the bot : sat or mon no sun. The bot keeps track and tries to fit a date
14:30:10FromDiscord<Yardanico> In reply to @hmmm "is there somewhere a": that's a question for #offtopic I think
14:30:14FromDiscord<hmmm> if it doesnt exist I will build it ffs I'm sick of all the peoples
14:30:35FromDiscord<hmmm> you are right, how do I transfer it there
14:30:41FromDiscord<Yardanico> just post a message there too :P
14:30:51FromDiscord<hmmm> 😋
14:30:57FromDiscord<Yardanico> deleting the message here is pointless at this point, because messages are relayed to matrix and IRC
14:31:04FromDiscord<Yardanico> and irc doesn't have a feature to delete messages :)
14:31:16FromDiscord<Yardanico> so anything you post in this chat is saved forever, for everyone to see
14:31:32FromDiscord<hmmm> sorry boiz I didnt think it throu 😅
14:31:47FromDiscord<Yardanico> no, it's fine
14:31:57FromDiscord<Yardanico> In reply to @PMunch "<@177365113899057152>, it's kinda hard": yeah, I don't really know either...
14:32:15FromDiscord<Yardanico> after cloning the same sciter repo again from scratch and using your code it still errors out
14:32:26FromDiscord<Yardanico> your clang is 13.0.0 right? since you're on arch
14:37:15PMunchYup
14:37:43PMunchAnd Nim 1.6.0
14:38:45*fputs2 joined #nim
14:41:02*fputs quit (Ping timeout: 252 seconds)
14:41:02*fputs2 is now known as fputs
14:59:17FromDiscord<dain> can you override the `[]` like you can in python?
14:59:26FromDiscord<Yardanico> yes
15:00:28FromDiscord<Yardanico> obviously in real code you wouldn't return the key itself :)
15:00:47FromDiscord<Yardanico> and to export the operator you use the asterisk
15:01:13FromDiscord<Yardanico> sent a code paste, see https://paste.rs/9ov
15:01:18kobithanks guys for the help and moral support ;-) see you later!
15:01:19FromDiscord<Yardanico> So that if other modules import this module, they get access to `[]`. Don't forget to export `MyType` too if you want that though
15:01:26*kobi quit (Quit: Leaving)
15:01:33FromDiscord<Yardanico> sent a code paste, see https://paste.rs/arG
15:15:29FromDiscord<dain> what if other modules don't import my module
15:16:03FromDiscord<dain> like suppose in some stdlib module there is `foo[x]` and I override `[]` so that it works with the type of `x`
15:16:12FromDiscord<Yardanico> In reply to @dain "what if other modules": i was talking specifically about if other modules want to use your type and your []
15:16:19FromDiscord<Yardanico> if they don't import your module, they won't be able to use it obviously
15:16:49FromDiscord<dain> oh
15:16:58FromDiscord<dain> so i can't use it like static duck typing?
15:18:40FromDiscord<Yardanico> can't say I really understood your question, but you can use generics as "static duck typing"
15:18:47FromDiscord<Yardanico> but only for procs that actually accept something generic
15:19:58Amun-Radain: you can have concepts that work pretty similar
15:20:07FromDiscord<Yardanico> you can't have your operator "propagate" to all modules, they need to import your module explicitly
15:20:19FromDiscord<Yardanico> @Amun-Ra they're still generics though, but yes
15:21:06FromDiscord<dain> well in this julia talk https://www.youtube.com/watch?v=kc9HwsxE1OY↵they have a pre-existing algorithm that uses a generic matrix multiplication. they create a special vector type and define a function for matrix-vector product that is optimized for their special vector type. they pass the vector into the pre-existing algorithm and it automatically uses the optimized implementation for that type
15:21:08nrds<R2D299> outube: 7"JuliaCon 2019 | The Unreasonable Effectiveness of Multiple Dispatch | Stefan Karpinski"
15:21:31FromDiscord<dain> despite the existing algorithm not having any knowledge of this type or the optimized multiplication implementation
15:22:05FromDiscord<Yardanico> In reply to @dain "well in this julia": well, as i said, use generics if you want this
15:22:16FromDiscord<Yardanico> they are using generics, it's just that in julia if you omit the types you get a generic function it seems like
15:22:29FromDiscord<dain> ah okay
15:22:43FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#generics
15:24:25FromDiscord<Yardanico> so if you make a `proc call[T](data: T)` it'll accept a value of any type, but of course it will only work if the type has all the necessary procedures/fields that you are using inside the proc
15:24:39FromDiscord<Yardanico> concepts help with that - they allow you to _specify_ what exactly do you want in a type for the proc to work for it
15:24:56FromDiscord<Yardanico> https://nim-lang.github.io/Nim/manual_experimental.html#concepts
15:25:18FromDiscord<Yardanico> just don't forget that concepts are a purely compile-time thing and don't exist on runtime, so you can't do seq[MyConcept]
15:25:26*Vladar quit (Remote host closed the connection)
15:26:42*lumo_e joined #nim
15:31:46FromDiscord<dain> hm
15:32:25FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GFZ
15:33:12FromDiscord<dain> `sum` is already generic but the return type has to be the same, i.e. sum over sequence of ints must be an int
15:33:18FromDiscord<dain> but here i have bool,bool->int
15:33:23FromDiscord<dain> and i don't know how to annotate it
15:33:50FromDiscord<dain> (edit) "`sum` ... is" added "in the math module"
15:34:48FromDiscord<Yardanico> In reply to @dain "okay so how do": not sure what you mean, your return type is just `int` isn't it?
15:35:04FromDiscord<dain> yes but when I'm defining `sum` I don't know that yet, do I?
15:35:08FromDiscord<dain> because it's generic
15:35:33FromDiscord<dain> like i could make bool+bool return a string if i wanted to
15:35:58FromDiscord<Rika> `sum[T, U](x: openArray[T]): U` ?
15:36:08FromDiscord<Yardanico> that'll require you to specify the return type manually
15:36:12FromDiscord<Rika> which is basically just the auto one too
15:36:17FromDiscord<Rika> just explicit
15:36:22FromDiscord<Rika> not sure what you want to be honest
15:36:31FromDiscord<Yardanico> i get what you want @dain , wait a bit
15:36:39FromDiscord<dain> In reply to @Rika "`sum[T, U](x: openArray[T]): U`": that was the first thing I tried, it said it couldn't instantiate `U` or something
15:36:39FromDiscord<Yardanico> i'm sure this can be made to work through typeof
15:36:53FromDiscord<Rika> ah yeah
15:36:55FromDiscord<Rika> i get why]
15:36:57FromDiscord<Yardanico> In reply to @dain "that was the first": yeah nim doesn't have return type inference
15:36:58FromDiscord<Rika> dumb mistake
15:37:00FromDiscord<Rika> sorry
15:37:05FromDiscord<Yardanico> so you can't do it the U way
15:37:13FromDiscord<Rika> auto is the only way i assume
15:38:47*lumo_e quit (Ping timeout: 252 seconds)
15:39:14FromDiscord<Yardanico> @Rika auto won't work here because `result` is of an unkown type
15:39:17FromDiscord<Yardanico> (edit) "unkown" => "unknown"
15:40:08FromDiscord<dain> yeah I wondered if there was a way to ask the compiler about the return type and use that
15:40:15FromDiscord<Yardanico> @dain this works but I'm not sure it's the best way
15:40:22FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GG0
15:40:29FromDiscord<Yardanico> the first line in the proc is to hint to the compiler what the return type should be
15:40:45FromDiscord<dain> `result = default(typeof(default(T) + default(T)))` <- perfect, this is what I was thinking of
15:40:48FromDiscord<Yardanico> sadly `typeof(default(T) + default(T))` as the return type doesn't seem to work
15:40:53FromDiscord<Yardanico> but it works in the proc body
15:40:56FromDiscord<dain> oh :(
15:41:04FromDiscord<dain> oh :)
15:41:34FromDiscord<Yardanico> basically you ask typeof for the type returned by + for two T's
15:41:39FromDiscord<Yardanico> and then assing default of that type to result
15:41:50FromDiscord<Yardanico> default for types is just the zeroed value, so for basic value types it's all 0
15:41:55FromDiscord<Yardanico> for ref types it'll be nil for example
15:42:06FromDiscord<dain> hm
15:42:46FromDiscord<dain> is there a way to get the return type purely from the type information? rather than instantiating the zero-values and then adding them and reflecting on the return type
15:43:03FromDiscord<Rika> not really
15:43:26FromDiscord<dain> like some kind of function where I can ask the compiler:↵↵`return_type_of(some_func, T, U, V, ...)`
15:43:42FromDiscord<dain> would be useful
15:43:53FromDiscord<Rika> doesnt really work
15:44:29FromDiscord<Rika> nim has argument name overloading so in some (admittedly very rare) cases that wouldnt work↵though i guess it could just error when it does
15:45:11FromDiscord<dain> what is argument name overloading
15:45:55FromDiscord<Rika> proc (a: int, b: int) and proc (a: int, x: int) can be distinguished by `call(1, x = 0)` or `call(1, b = 0)`
15:46:41FromDiscord<dain> oh damn
15:46:55FromDiscord<Rika> ...i think its still there
15:47:01FromDiscord<Rika> not sure if it was ever removed or whatever
15:47:03FromDiscord<Yardanico> @dain as I thought, that example can be made to work with concepts
15:47:14FromDiscord<dain> well maybe it could be `return_type_of(some_func, a=T, b=U)`
15:47:18FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GG5
15:47:59FromDiscord<Yardanico> MyType.T here is syntax for getting the type parameter for an implicit generic type
15:48:12FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GG6
15:48:16FromDiscord<Yardanico> you can have it as `func sum[T](x: openArray[MyType[T]]): T =` instead (with same concept definition)
15:48:44FromDiscord<Yardanico> In reply to @dain "i dont understand what": concepts are basically constraints for types
15:49:06FromDiscord<dain> so in this case we could call `MyType[T]` `Summable[T]` or something?
15:49:18FromDiscord<Yardanico> i guess, yeah
15:49:25FromDiscord<Yardanico> but usually summables return the sum of the same type
15:49:28FromDiscord<dain> well more like `SummableTo[T]`
15:49:32FromDiscord<Yardanico> yeah
15:50:28FromDiscord<Yardanico> just keep in mind that concepts are (still) experimental and the change that you'll get a compiler crash when using them is higher than in normal code :)
15:50:33FromDiscord<Yardanico> (edit) "change" => "chance"
15:51:06FromDiscord<TryAngle> @Yardanico ↵hi sorry for interfering,↵how stable are concepts right now as they're still experimental & is there a roadmap / general idea when they'll be stabilized?
15:51:34FromDiscord<Yardanico> I can't say for sure, but in https://github.com/nim-lang/RFCs/issues/437 they're in stretch goals
15:51:51FromDiscord<Yardanico> and about the stability - well, it's hard to judge, when they work, they work
15:52:07FromDiscord<Yardanico> you can check open issues with the Concepts label - https://github.com/nim-lang/Nim/issues?q=is%3Aopen+is%3Aissue+label%3AConcepts
15:52:16FromDiscord<dain> there are some other places where you could conceivably have a sum that returns something of a different type. e.g. char+char->string
15:53:14FromDiscord<TryAngle> because if they get stable I don't think I would ever use something other than nim again 😂
15:53:17FromDiscord<TryAngle> In reply to @Yardanico "you can check open": thanks
15:59:23FromDiscord<dain> on a completely other topic
15:59:27FromDiscord<dain> does nim have a mascot?
16:00:04FromDiscord<Yardanico> no
16:00:15FromDiscord<Yardanico> there were some proposed designs but nothing was made official :)
16:00:32FromDiscord<dain> i would buy a nim plushie
16:00:36FromDiscord<dain> whatever the animal is
16:01:10FromDiscord<Yardanico> just buy a crown instead :P
16:04:42FromDiscord<IsaacPaul> How I support nim: "Treat yourself... king" 🤴 ↵😂
16:20:13FromDiscord<dithpri> sent a code paste, see https://play.nim-lang.org/#ix=3GGs
16:39:19FromDiscord<IsaacPaul> o.O
16:39:22FromDiscord<IsaacPaul> I don't see the bug
16:39:43FromDiscord<IsaacPaul> wait
16:43:24FromDiscord<IsaacPaul> I think m[K] is not Stringifiable?
16:43:46FromDiscord<IsaacPaul> It looks like you're using a type as a key when you need to use a key as a key? but idk
16:48:40FromDiscord<IsaacPaul> having generics and [] accessor use the same characters [] is kinda confusing but I think that's what's going on. I just don't have time to research and verify.
16:58:32FromDiscord<Recruit_main707> what happens if you do \`[]`(m, K)?
17:00:06FromDiscord<dain> how do I specify that a parameter can just be anything that can be iterated over
17:00:17FromDiscord<dain> I tried `iterator[T]` and `iterable[T]` but they didn't work
17:00:55FromDiscord<Yardanico> one way is
17:01:05FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GGR
17:01:07FromDiscord<dain> :D neat
17:01:11FromDiscord<Yardanico> but this just ensures that the type has `items` defined for it
17:01:14FromDiscord<dain> let me try that
17:01:17FromDiscord<Yardanico> so you can just say
17:01:55FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GGS
17:02:22FromDiscord<Yardanico> i actually used that concept in https://github.com/Yardanico/nimpylib/blob/master/src/pylib.nim#L27 (that whole pylib module is really made just for fun though, don't use it in real projects :P)
17:02:29FromDiscord<dain> doesn't x.items give an iterable over T and not the T itself?
17:02:47FromDiscord<Yardanico> it
17:02:56FromDiscord<Yardanico> it's the return type of the `items` iterator
17:03:08FromDiscord<Yardanico> so it's T since we don't exactly know it
17:06:24FromDiscord<dain> awesome
17:06:26FromDiscord<dain> so i can do this
17:06:35FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GGT
17:06:46FromDiscord<dain> overload `[]` to take a function
17:06:56FromDiscord<Yardanico> xdddd
17:07:08FromDiscord<Yardanico> that is an... interesting usage of `[]`
17:07:09FromDiscord<dain> although it breaks if i use `=>`
17:07:12FromDiscord<Yardanico> never seen before
17:07:29FromDiscord<dain> pandas has it
17:07:34FromDiscord<Yardanico> i mean it's obvious that this works because an anonymous procedure is a first class value just like a string
17:07:42FromDiscord<Yardanico> In reply to @dain "pandas has it": yes but nim is not pandas :)
17:07:43FromDiscord<dain> although it works differently, the argument is the whole array rather than an individual element
17:07:54FromDiscord<Yardanico> you can have templates and a lot of other stuff instead of overloading []
17:08:25FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GGU
17:08:37FromDiscord<dain> `Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature.`
17:08:45FromDiscord<Yardanico> yes, because nim can't figure out the types
17:09:59FromDiscord<Yardanico> while not exactly what you want, have you seen https://github.com/zero-functional/zero-functional?
17:10:00FromDiscord<Yardanico> (edit) "https://github.com/zero-functional/zero-functional?" => "https://github.com/zero-functional/zero-functional ?"
17:10:01nrds<R2D299> itHub: 7"A library providing zero-cost chaining for functional abstractions in Nim."
17:10:02nrds<R2D299> itHub: 7"A library providing zero-cost chaining for functional abstractions in Nim."
17:10:20FromDiscord<dain> ive heard of it but not looked in great detail
17:18:02FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3GGY
17:18:15FromDiscord<Yardanico> nope
17:18:23FromDiscord<TryAngle> ok ty
17:19:02FromDiscord<Yardanico> that said, I'd recommend using https://nim-lang.github.io/fusion/src/fusion/matching.html for matching object variants so that you do less mistakes (accessing the wrong branch, etc)
17:19:32FromDiscord<TryAngle> I've read fusion was "dead"
17:19:39FromDiscord<TryAngle> is that not the case "anymore"
17:19:42FromDiscord<TryAngle> (edit) ""anymore"" => ""anymore"?"
17:19:49FromDiscord<haxscramper> yes, it is dead
17:20:05FromDiscord<haxscramper> you just won't get new fixes unless someone moves their fat ass
17:20:17FromDiscord<haxscramper> most likely this won't happen though
17:20:52FromDiscord<haxscramper> I moved pattern matching here https://haxscramper.github.io/hmisc/hmisc/macros/matching.html
17:22:03FromDiscord<haxscramper> I mean, it is not even on the roadmap
17:22:10FromDiscord<TryAngle> hmm haven't felt the need for extra matching libraries yet but will look into it maybe
17:22:24FromDiscord<haxscramper> it is not "extra" matching library
17:22:26FromDiscord<Yardanico> In reply to @TryAngle "hmm haven't felt the": I mean it'll be pretty useful if you're doing a lot of stuff with object variants
17:22:30FromDiscord<haxscramper> it is the "official" library
17:22:36FromDiscord<haxscramper> that I just don't want to die
17:23:17FromDiscord<haxscramper> anyway, just for using variant objects it is not necessary
17:23:32FromDiscord<Yardanico> yeah, I didn't say it's necessary, just that it's useful
17:23:33FromDiscord<haxscramper> and `case` thing does not add readability either
17:23:41FromDiscord<haxscramper> why in the world did I even use this feature
17:23:56FromDiscord<TryAngle> In reply to @Yardanico "I mean it'll be": might be I'm working a markdown-like parser, so nothing that huge↵but if I have somehting huge, I will sure look into it thanks!
17:24:01FromDiscord<Yardanico> In reply to @TryAngle "might be I'm working": oh, okay
17:24:18FromDiscord<Yardanico> for some "inspiration" we have https://github.com/kyoheiu/nmark and https://github.com/soasme/nim-markdown
17:24:20nrds<R2D299> itHub: 7"A fast markdown converter, based on CommonMark, written in Nim."
17:24:25FromDiscord<Yardanico> the latter seems to be more popular, but quite overengineered
17:25:34FromDiscord<TryAngle> In reply to @Yardanico "for some "inspiration" we": thanks!↵also MIT License 😳
17:25:40FromDiscord<Yardanico> is that not ok?
17:25:46FromDiscord<Yardanico> Nim itself is MIT, and most libraries for it are MIT
17:25:49FromDiscord<TryAngle> no that's a good thing XD
17:28:21FromDiscord<Yardanico> nmark is about 5 times faster than nim-markdown but it doesn't pass all commonmark tests
17:30:11FromDiscord<Yardanico> nmark itself is also around 10% faster when compiled with orc, but markdown is much much much slower with orc, but that's not its fault
17:30:27FromDiscord<Yardanico> it's just because methods are at least 10x slower under orc than in refc
17:31:24FromDiscord<TryAngle> ah I see, I will look into them 😄
17:31:53PMunchsoasme/nim-markdown is pretty neat
17:31:58PMunchQuite extensible
17:32:21PMunchI wanted to use it for a small thing, but I couldn't get Gtk to show a webview properly
17:32:31FromDiscord<Yardanico> well nmark actuall does have an AST representation too :)
17:33:09FromDiscord<Yardanico> the problem with markdown is that it uses methods extensively, and also pcre
17:33:20FromDiscord<Yardanico> nmark is built on procs with pure-nim `regex` module and is fater
17:33:22FromDiscord<Yardanico> (edit) "fater" => "faster"
17:33:45PMunchPro of markdown is that you can add/remove features to your liking very easily
17:33:56PMunchHaven't tried nmark though, might be possible there as well
17:34:40FromDiscord<Yardanico> ah yeah, nmark doesn't have that, but it shouldn't be hard to add to the library
17:37:13FromDiscord<TryAngle> In reply to @PMunch "Pro of markdown is": that was why I started using it but the combination of some plugins is just so tiresome at least in VSC that I jsut can't anymore
17:37:36PMunchHuh?
17:37:38FromDiscord<Yardanico> did you mean markdown as in the format itself? we were talking about the library :P
17:37:49FromDiscord<TryAngle> ah yes I mean markdown itself XD
17:37:53PMunchAh right :P
17:38:03PMunchsoasme/nim-markdown
17:38:04FromDiscord<Yardanico> since nim doesn't have a lot of packages, packages get to "occupy" nice names
17:38:10FromDiscord<TryAngle> thought the last comment was about it
17:38:13FromDiscord<Yardanico> e.g. soasme's nim-markdown is just `nimble install markdown`
17:39:20PMunchWhat did you replace markdown (the tech) with @TryAngle
17:41:11FromDiscord<narimiran> hey PMunch! will you stream your AoC solving this year?
17:44:00FromDiscord<TryAngle> In reply to @PMunch "What did you replace": well I'm working on implementing the most basic things atm and learning the lang nim (it's my first project with it), got some things working already aswell...↵but mainly I want to remove the need for html and get KaTeX working.. maybe also make some parts of KaTeX easier to write but idk yet.. I really dont like the constant need for `\begin{..} ... \end{..}` and also I don't like typing `
17:44:29PMunchDon't think so unfortunately :( I'm not living alone any longer, and I fear it might be a bit disruptive if I stream for two hours every day in the living room :P
17:44:37PMunchBut I can do today :)
17:45:01FromDiscord<narimiran> congrats? 🙂
17:47:34*lumo_e joined #nim
17:53:16PMunchHaha, congrats is correct :P
17:53:48PMunchMoving in with my new girlfriend, haven't hit hard times and have to rent out a room to a stranger
17:54:30FromDiscord<narimiran> congrats!
17:57:04anddamhowdy, back again at using imgui binding, I installed nimgl/imgui from repo, using nimble, then try to run tests/test.nim for starters
17:57:30anddamI used nim cpp test.nim in order to use the native library and not the C wrapper
17:58:35anddamI have a missing library (and rightfully so) since I do not have imgui header installed, but am I supposed to install in one of the "default" nim looking path?
17:59:25FromDiscord<Yardanico> what error do you get? nimgl/imgui ships imgui with itself
17:59:26anddamcase in point the failing line has -I/home/anddam/Development/Nim/nimgl-imgui-git/src/imgui/private/cimgui -I/home/anddam/.choosenim/toolchains/nim-1.6.0/lib -I/home/anddam/Development/Nim/nimgl-imgui-git/tests
17:59:51FromDiscord<Yardanico> can you show the full output of the error? you can post to some pasting service
18:00:16FromDiscord<Yardanico> how did you install imgui btw?
18:00:21FromDiscord<Yardanico> did you `git clone` it by any chance?
18:01:04anddamhttps://termbin.com/kct2
18:01:05FromDiscord<Yardanico> if so, you probably didn't do `git clone --recursive` which is required because cimgui is a git submodule of nimgl/imgui
18:01:06PMunch@narimiran, dinner first, then stream I think :)
18:01:14anddamoh the submodules
18:01:26PMunchOh damn, it's 7PM already :S
18:01:32FromDiscord<Yardanico> it shows nimble direct isntall just below btw @anddam
18:01:35FromDiscord<Yardanico> (edit) "isntall" => "install"
18:01:38anddamI installed by simple git clone, but not nimgl, just nimgl/imgui's repo
18:01:38FromDiscord<Yardanico> in the readme i mean
18:01:40FromDiscord<narimiran> ah, later on i'll have to do my family obligations, so i'll probably miss it
18:02:18FromDiscord<narimiran> but hopefully you'll do it in the following days too 🙂 (when the tasks are easy and solvable in ~15 min)
18:02:18anddammmm I think I used nimble install
18:02:32anddamcan I force install over it using nimble just to be sure?
18:02:58FromDiscord<Yardanico> if you already have a git repo you can do `git submodule update --init --recursive` and then run `nimble install` again
18:03:10FromDiscord<Yardanico> you can also just do `nimble install https://github.com/nimgl/imgui.git` to let nimble do the cloning by itself
18:03:41*krux02 joined #nim
18:03:43anddamI checked shell history, I had installed with nimble in first place, and I have overwrote it now
18:05:39anddamok, I get the very same output by running nim cpp tnull.nim
18:05:48anddamwhereas test.nim lacks nimgl/opengl
18:06:02anddaminstalling nimgl with nimble now
18:06:56anddamand now the various X dev packages
18:08:11anddamYardanico: I remember you told me that the C API required building cimgui lib, whereas the cpp backend would work without any specific lib
18:08:17FromDiscord<Yardanico> yes
18:08:38FromDiscord<Yardanico> but you need something like opengl to _output_ imgui to something
18:08:50anddamand I did install that
18:09:05anddamI still have the missing imgui/imgui.h header
18:09:26anddamwhat I do not get are these inclusion options -I/home/ada/Development/Nim/nimgl-imgui-git/src/imgui/private/cimgui -I/home/ada/.choosenim/toolchains/nim-1.6.0/lib -I/home/ada/Development/Nim/nimgl-imgui-git/tests
18:09:49FromDiscord<Yardanico> is there a problem with them? they seem normal
18:10:08FromDiscord<Yardanico> also I just did `nimble install https://github.com/nimgl/imgui` and imgui works for me
18:10:10FromDiscord<Yardanico> the test.nim
18:10:52FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHj
18:11:20FromDiscord<Yardanico> because `lines` itself is an iterator
18:11:32FromDiscord<dain> yeah that's what I want
18:11:34FromDiscord<dain> i want to map over it
18:11:37FromDiscord<dain> lazily
18:12:24anddamYardanico: the problem is those are "odd" paths for me to provide the library
18:12:44FromDiscord<Yardanico> why? they're perfectly normal
18:12:50FromDiscord<Yardanico> since imgui lib bundles the imgui itself
18:12:55FromDiscord<Yardanico> so it needs imgui include files to compile
18:13:12FromDiscord<Yardanico> In reply to @dain "yeah that's what I": well this wasn't even possible before nim 1.6, but now you can use `iterable[T]` to at least pass an iterator like that to a template, not an iterator though
18:13:15anddamI am missing something
18:13:50FromDiscord<dain> In reply to @Yardanico "well this wasn't even": i don't understand why the thing i'm passing to map (the result of `lines`) isn't matching the concept I defined
18:13:55FromDiscord<Yardanico> for me it uses `g++ -c -std=gnu++14 -funsigned-char -w -fmax-errors=3 -fpermissive -I/home/dian/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1 -D_GLFW_X11 -I/home/dian/Things/nim/lib -I/home/dian/Projects/nmark -o /home/dian/.cache/nim/fa_d/imgui_demo.cpp.o /home/dian/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui/imgui/imgui_demo.cpp` to compile and works
18:14:12FromDiscord<Yardanico> In reply to @dain "i don't understand why": because default nim iterators are inline iterators, they're not really first class values
18:14:17FromDiscord<dain> oh
18:14:34FromDiscord<dain> so how do you lazily map over them?
18:14:40anddamYardanico: -I/home/dian/.nimble/pkgs/imgui-1.84.2/imgui/private/cimgui is saner since it points to .nimble
18:14:51FromDiscord<Yardanico> but that's because I installed with `nimble install`
18:15:03FromDiscord<Yardanico> did you perhaps do `nimble develop` in the past? maybe that's why it still links to your own dir
18:15:12FromDiscord<Yardanico> but it should've overwritten it anyway, hm
18:15:21FromDiscord<Yardanico> In reply to @dain "so how do you": well, as I said, with nim 1.6 you can use a template with `iterable[T]`
18:15:40anddamI don't think so, I didn't even have nim on this system until a few minutes ago
18:16:09FromDiscord<dain> In reply to @Yardanico "well, as I said,": how does it work with a template? can I still use yield inside? if not what do I replace it with
18:16:37FromDiscord<Yardanico> In reply to @anddam "I don't think so,": so again, did you do `nimble install https://github.com/nimgl/imgui` or not?
18:16:44FromDiscord<Yardanico> it will take a while and you shouldn't ctrl+c it
18:16:51FromDiscord<Yardanico> because it clones recursively and takes some time to finish cloning
18:17:07FromDiscord<Yardanico> if you installed `nimgl`, you need to refer to imgui in it with `nimgl/imgui` because that's a different module
18:17:11anddamYardanico: yes, I did. I did not kill the process
18:17:38anddamI have now removed all nimble packages using 'nimble remove'
18:17:52anddamI have zero packages listed using --install and will try again
18:18:30anddamhttps://termbin.com/8ogb
18:18:36anddamtook ~20 seconds
18:18:58FromDiscord<Yardanico> yep
18:19:15anddamok, now I get the test.nim file, only the file and not the whole repo
18:19:17anddamsounds about right?
18:19:21FromDiscord<Yardanico> yes
18:19:27anddamand try nim cpp test.nim
18:19:35anddam/home/ada/.nimble/pkgs/imgui-1.84.2/imgui/impl_opengl.nim(11, 23) Error: cannot open file: nimgl/opengl
18:19:46FromDiscord<Yardanico> yes, because imgui needs opengl for drawing
18:19:47anddamthis is because the test.nim example does in fact rely on nimgl
18:19:51FromDiscord<Yardanico> so you `nimble install nimgl`
18:20:05anddamrunning
18:20:39*anddam oopses
18:20:43anddam/bin/ld: cannot find -lGL
18:20:51FromDiscord<Yardanico> heh
18:20:59FromDiscord<Yardanico> you need opengl dev libs for your distro
18:21:21FromDiscord<Yardanico> mesa-devel or something like that
18:21:41FromDiscord<Yardanico> on debian-like distros it's `libgl1-mesa-dev`
18:21:44anddamlibglvnd in my case
18:21:58FromDiscord<Yardanico> that's not the same thing
18:22:12FromDiscord<Yardanico> but if it works, okay
18:22:12anddambut it's the package providing libGL
18:22:28anddamand the linker was failing there
18:22:42FromDiscord<Yardanico> just install `mesa-common-dev` and be done with it :)
18:22:48FromDiscord<Yardanico> it installs all necessary dev viles
18:22:49FromDiscord<Yardanico> (edit) "viles" => "files"
18:22:59FromDiscord<michaelb> will `isValidSha1Hash` in Nim 1.6's `std/sha1` be backported to 1.2.x and 1.4.x so those release lines will be compatible with nimble >= 0.14.0 ?
18:23:02anddamactually I had to install libglvnd-devel, apparently /usr/lib/libGL.so.1 was not enough
18:23:09anddamYardanico: not on my system, that is Void
18:23:22anddamrunning
18:23:25anddamthanks
18:23:42anddamnow for the sake of knowledge how do I go in order to build the cimgui?
18:23:45FromDiscord<Yardanico> In reply to @brainproxy "will `isValidSha1Hash` in Nim": i think you should ask that on the forum or open an issue, your question will get lost in this chat quite quickly
18:23:58FromDiscord<michaelb> good point, thanks 🙂
18:24:23FromDiscord<michaelb> and in any case would be better to ask in #nimble
18:24:26anddamor rather by cimgui do I need to build https://github.com/nimgl/cimgui this?
18:24:28nrds<R2D299> itHub: 7"c-api for imgui (https://github.com/ocornut/imgui)"
18:24:34FromDiscord<Yardanico> In reply to @anddam "or rather by cimgui": nonono
18:24:51FromDiscord<Yardanico> In reply to @anddam "now for the sake": you do all the necessary cloning and compilation steps in https://github.com/cimgui/cimgui, place the resulting `cimgui.so` in the same folder as `test.nim` and then compile your test with `nim c` and run with `LD_LIBRARY_PATH=. ./test`
18:25:03FromDiscord<Yardanico> you can have it in a different folder too, but then you'll have to point `LD_LIBRARY_PATH` to that folder
18:25:18FromDiscord<Yardanico> or just place it somewhere in your $PATH, then you won't need to set LD_LIBRARY_PATH
18:25:24anddamor place the so in a path where the linker looks by default
18:25:36FromDiscord<Zoom> So, how was your first day of AOC? Pretty content with myself, managed to want an `{.experimental.}` feature on the first day
18:25:53FromDiscord<Yardanico> @Zoom fine, btw, we have a separate channel for AoC :) it's fine to post here though too
18:25:56anddamcan I make a static build of that and then bundle the whole shebang in the resulting executable from the nim compilation?
18:26:02FromDiscord<Zoom> Anyone had any experience with extending zero functinoal using their DSL?
18:26:08FromDiscord<Yardanico> In reply to @anddam "can I make a": yes, you'll have to link cimgui statically then
18:26:11anddam(I remember I was told I could, I need some pointers again)
18:26:33FromDiscord<Zoom> I don't see it in the Space↵(@Yardanico)
18:26:46FromDiscord<Yardanico> i guess it's not bridged to matrix :(
18:28:03FromDiscord<Yardanico> In reply to @anddam "(I remember I was": compile cimgui statically with the docs they have, then you add it as an argument to link for the C compiler (with passC/passL), and also do --dynlibOverride:"cimgui"
18:29:09FromDiscord<Yardanico> so that nim doesn't try to load it at runtime (that's what `dynlib` pragma does and imgui module uses it)
18:29:12FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHn
18:31:49FromDiscord<Zoom> Here's the issue I'm having with zero\_functional\: https://play.nim-lang.org/#ix=3GHo
18:32:31FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHq
18:32:51FromDiscord<Zoom> The line 16 compiles fine, but there's the `state` variable injection fails for line 18.
18:33:53FromDiscord<dain> In reply to @Yardanico "i don't remember why": that still gives me an error
18:34:00FromDiscord<Yardanico> huh
18:34:12FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHs
18:34:21FromDiscord<dain> i'm on 1.6
18:34:42FromDiscord<Yardanico> works on 1.6 in the playground though https://play.nim-lang.org/#ix=3GHt
18:34:51FromDiscord<Yardanico> it might be that it's choosing the wrong `map` if you have more than one of them in the same namespace
18:35:05FromDiscord<Yardanico> wait, ah
18:35:09FromDiscord<Yardanico> you're trying to iterate over that iterator
18:35:28FromDiscord<Yardanico> closure iterators are different from normal ones, you need to use loops to iterate over them (or write a helper iterator that does that for you)
18:35:37FromDiscord<Yardanico> wait nvm, that works as well
18:35:38FromDiscord<dain> ?
18:35:59FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHu
18:36:34FromDiscord<dain> it breaks
18:36:58FromDiscord<Yardanico> huh
18:37:08FromDiscord<Yardanico> ahh right
18:37:16FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHw
18:37:20FromDiscord<Yardanico> @dain you need to import `sequtils` as well
18:37:39FromDiscord<Yardanico> it has an iterator to iterate over values in a closure iterator because they don't have `items` by default, as I said
18:37:39FromDiscord<Yardanico> https://nim-lang.org/docs/sequtils.html#items.i
18:37:45FromDiscord<dain> why? i deliberately didn't import sequtils so that its `map` doesn't interfere with mine
18:37:49FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHx
18:37:56FromDiscord<Yardanico> In reply to @Yardanico "https://nim-lang.org/docs/sequtils.html#items.i": because of this ^
18:37:59FromDiscord<dain> oh
18:38:07FromDiscord<Yardanico> In reply to @Yardanico "it has an iterator": meant to point to this, but ok
18:38:08FromDiscord<michaelb> is it possible to get forum.nim-lang.org to resend an email confirmation link?↵↵apparently, about 1 year ago I signed up but didn't click the confirmation link (because it landed in my Junk email folder, found it a few min ago); I tried doing a password reset just now, but after re-login, I'm still seeing my email is unconfirmed and therefore I can't create a past
18:38:12FromDiscord<michaelb> (edit) "past" => "post"
18:38:20FromDiscord<Yardanico> In reply to @brainproxy "is it possible to": i can confirm you manually, what's your nickname ?
18:38:24FromDiscord<michaelb> brainproxy
18:38:33FromDiscord<dain> okay yes now it works
18:38:37FromDiscord<Yardanico> In reply to @brainproxy "brainproxy": yeah, confirmed
18:38:40FromDiscord<michaelb> nice, thanks!
18:39:04FromDiscord<dain> also yes needing parentheses for the iterator is ugly looking
18:40:25FromDiscord<dain> okay now I stuck a `.to_seq` at the end and it broke again
18:40:26FromDiscord<dain> :(
18:40:35FromDiscord<dain> how do I get it as a sequence
18:40:51FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GHy
18:41:04FromDiscord<Yardanico> you still need sequtils because toSeq needs it to iterate over the "thing" that you want to make into a seq
18:41:13FromDiscord<Yardanico> needs `items` specifically
18:41:50FromDiscord<dain> that's exactly what I have
18:42:27FromDiscord<Yardanico> ah you're right it doesn't work
18:42:44FromDiscord<Yardanico> it's not really meant to work with closure iterators it seems like, you can write a custom `toSeq` though
18:42:44FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHz
18:42:53FromDiscord<dain> why is this so hard :x
18:43:18FromDiscord<Yardanico> and generally composing iterators like that is a pain even currently, because iterable[T] only works in templates and closure iterators are different from inline iterators
18:43:29FromDiscord<Yardanico> and used less than inline iterators
18:43:34NimEventerNew thread by Brainproxy: Will isValidSha1Hash in Nim 1.6's std/sha1 be backported to 1.2.x and 1.4.x?, see https://forum.nim-lang.org/t/8669
18:43:36FromDiscord<dain> i just want to be able to work with lazy iterations the same as I do in python
18:43:39FromDiscord<dain> composing them and stuff
18:44:39FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3GHA
18:44:43FromDiscord<DaiChimpo> I'm not too great at regex, if I wanted to split a string by the vowels, and include the vowels, wouldn't it be string.split(r"(A|E|I|O|U)")
18:45:18FromDiscord<dain> In reply to @Zoom "dain I use zero\_functional,": I did look at zero functional but it looks like you have to use its own special DSL if you want to define your own functions that work with it
18:45:22FromDiscord<dain> and it looks awkward
18:45:34NimEventerNew thread by Nick14: Read next string from stdin, see https://forum.nim-lang.org/t/8670
18:46:01FromDiscord<Zoom> dain, do you really need to extend it? In it's basic form it's just one arrow and dot chaining
18:46:27FromDiscord<Zoom> I tried to extend it and got bitten though. Would appreciate if anyone with macro skills could look at↵https://play.nim-lang.org/#ix=3GHo
18:46:42FromDiscord<dain> well yes, it doesn't even have a `count()` function
18:46:51FromDiscord<dain> there's an example of `count()` in the docs but i couldn't make that work
18:48:22FromDiscord<Zoom> It works, or you can just `map(1).sum()`
18:50:45FromDiscord<Zoom> You can see in the paste above how the expansion works. You need to import macro, define/copy-paste `zfInline` block and call `static: zfCreateExtension()`. That's all
18:53:28FromDiscord<Zoom> All macros look awkward, and if you want to implement iterator composition you currently need to use lots them, unfortunately.
18:53:52FromDiscord<dain> okay I remember the problem I had now, I couldn't make `zip` work how I wanted with zero functional
18:54:28FromDiscord<TryAngle> How would I compile nim to a real C file or is that not possible?
18:54:43FromDiscord<Yardanico> In reply to @TryAngle "How would I compile": wdym "real C file"?
18:54:50FromDiscord<Yardanico> Nim is always compiled to C files when you use the C backends
18:54:53FromDiscord<Yardanico> they're just stored in the cache folder
18:54:58FromDiscord<Yardanico> (edit) "backends" => "backend"
18:55:02FromDiscord<Zoom> It does compile to real C by default↵(@TryAngle)
18:55:24FromDiscord<TryAngle> When I use nim or nimble it always compiles directly to a binary
18:55:32FromDiscord<TryAngle> Where do I find this cache folder?
18:55:47FromDiscord<Yardanico> In reply to @TryAngle "Where do I find": If you're on nix, it's ~/.cache/nim
18:55:50FromDiscord<Yardanico> why do you need it though?
18:56:02FromDiscord<TryAngle> I'm just interested
18:56:11FromDiscord<Yardanico> you're not supposed to look at C files unless you want to check for optimizations
18:56:21FromDiscord<Yardanico> it's not exactly supposed to be human readable, so just be warned :)
18:56:47FromDiscord<Yardanico> if you really want to study C code compiled by Nim without all the noise like safety checks, compile the program you want manually with `nim c -d:danger --gc:orc`
18:56:59FromDiscord<Yardanico> orc is not the default nim GC, but it offers less "noise" in the C code
18:58:03FromDiscord<TryAngle> Hmm I'm using WSL so I hope that path is the same
18:58:50FromDiscord<Yardanico> that directory has dirs that are named like "file_r" or "file_d" where file is the name of the main program Nim file
18:58:51FromDiscord<TryAngle> In reply to @Yardanico "if you really want": Using none or arc depending in the context could make it even more readable?
18:58:54FromDiscord<Yardanico> r or d mean debug or release
18:59:08FromDiscord<Yardanico> In reply to @TryAngle "Using none or arc": yes, but some programs have cycles so comparing with orc is more fair :)
18:59:11FromDiscord<Yardanico> you can use arc as well, yes
18:59:15FromDiscord<Yardanico> don't use `none`
19:00:05FromDiscord<TryAngle> What is bad with none?↵I thought the nim GBA game is written with none?
19:00:30FromDiscord<Yardanico> that is the case because it was written before ARC became a viable option for general usage
19:00:40FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHG
19:01:03FromDiscord<Yardanico> In reply to @TryAngle "What is bad with": also goodboy galaxy doesn't use dynamically allocated memory at all
19:01:05FromDiscord<Yardanico> "Natu works with both --gc:none and --gc:arc, though arc didn't exist when I started working on Goodboy Galaxy, but I've had success with it for other small projects. Right now everything in the game is on the stack or statically allocated, which is nice for performance, so the choice of memory management strategy doesn't matter all that much for me. However, I'm envious of the benefits that destructors could bring if I'd written the en
19:01:13FromDiscord<Yardanico> https://forum.nim-lang.org/t/8375#54033
19:01:58FromDiscord<Zoom> @dain\: you forgot to import `macros`
19:02:04FromDiscord<TryAngle> In reply to @Yardanico "that is the case": Ah ok I see thanks
19:02:10FromDiscord<dain> In reply to @Zoom "<@225449938258100225>\: you forgot to": ty
19:03:44FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHK
19:05:18FromDiscord<TryAngle> Speaking of Arc and Orc, the sink, lent, destructors etc. are only available when using them and the acyiclic pragma only with orc, using other gc they're all "ignored" @Yardanico ?
19:05:35FromDiscord<Yardanico> In reply to @TryAngle "Speaking of Arc and": destructors work with refc - they're mapped to finalizers, but of course then they're not deterministic
19:05:42FromDiscord<Yardanico> sink will just always copy on refc
19:05:47FromDiscord<Yardanico> lent doesn't work on refc as far as I know
19:05:52FromDiscord<Yardanico> acyclic pragma is only for orc, yes
19:07:08FromDiscord<TryAngle> Does lent on refc error or is it just ignored?
19:07:20FromDiscord<Yardanico> don't know, I guess it's easy to try out :)
19:08:45FromDiscord<TryAngle> I guess so 👍
19:27:33FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GHN
19:28:07FromDiscord<dain> why do I need to make a separate variable before passing it to `to_seq`? that's maddening
19:28:30FromDiscord<dain> i only discovered it by accident
19:29:33FromDiscord<dain> this has to be a bug right
19:29:43FromDiscord<Yardanico> it probably is
19:32:55FromDiscord<dain> right i'll make a github issue
19:45:42*PMunch quit (Quit: leaving)
19:46:56*PMunch joined #nim
19:50:13FromDiscord<Zoom> Zip is pretty fragile and expects sequences, as far as I understand. You don't need zip for the task though.↵(@dain)
19:51:58*advesperacit quit (Quit: advesperacit)
19:52:14FromDiscord<--HA--> sent a code paste, see https://play.nim-lang.org/#ix=3GHU
19:52:23FromDiscord<Yardanico> In reply to @--HA-- "What do I do": use `_` instead of `i`
19:52:27FromDiscord<dain> In reply to @Zoom "Zip is pretty fragile": yeah but i want to use zip :(
19:52:45FromDiscord<--HA--> Is `_somevarname` also a thing?
19:52:52FromDiscord<Yardanico> no
19:52:56FromDiscord<Yardanico> `_` is a special variable name
19:52:59FromDiscord<--HA--> Ok, thanks.
20:04:14PMunchAoC stream live now! https://www.twitch.tv/pmunche
20:06:46FromDiscord<DaiChimpo> Checking if a seq is empty should be done using if len(seq) == 0, right?
20:07:13FromDiscord<Yardanico> one of the ways to do it, yes
20:07:28FromDiscord<Yardanico> you can do seq.len for a "nicer" oop-like syntax
20:09:28FromDiscord<DaiChimpo> ok I'm getting an "`len(a) == L` the length of the seq changed while iterating over it [AssertionDefect]", but not on the check, if I add an else
20:09:38FromDiscord<DaiChimpo> sent a code paste, see https://play.nim-lang.org/#ix=3GI3
20:10:20FromDiscord<metamuffin> 9B9CB7C264E36573B4E381BFDEB519E8E26C2E6D917226AB90EFE1E4740BAB7AA578AA310524
20:10:31FromDiscord<DaiChimpo> (edit) "https://play.nim-lang.org/#ix=3GI3" => "https://play.nim-lang.org/#ix=3GI4"
20:11:00FromDiscord<DaiChimpo> If I comment out the else, no errors
20:12:13FromDiscord<Yardanico> In reply to @DaiChimpo "ok I'm getting an": can you show more code?
20:12:43FromDiscord<DaiChimpo> sure I'll edit it
20:13:59FromDiscord<DaiChimpo> done
20:18:58FromDiscord<Yardanico> In reply to @DaiChimpo "done": do you maybe have another loop outside of this one which iterates over `seq` as well or something?
20:19:05FromDiscord<Yardanico> that error comes when you modify a seq while iterating (quite obviously)
20:19:22FromDiscord<Yardanico> so if removing your second else means that you have some outer loop that is iterating over that seq as well?
20:19:34FromDiscord<Yardanico> (edit) "so if removing your second else ... means" added "removes the issue, it"
20:20:37FromDiscord<DaiChimpo> A different seq finishes looping before this ifelse, otherwise this one is only instantiated at program start
20:20:51FromDiscord<DaiChimpo> this is a head scratcher
20:21:08FromDiscord<Yardanico> maybe you can try to minimize the code or share the whole code somewhere? if it's not closed of course
20:21:09FromDiscord<Yardanico> as a repo maybe
20:23:36FromDiscord<Yardanico> also @DaiChimpo you can avoid using `i` in the innermost loop by using `mitems` :)
20:23:54FromDiscord<Yardanico> ah wait nvm
20:24:04FromDiscord<Yardanico> @DaiChimpo you modify the seq right in the loop
20:24:22FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GI9
20:24:36FromDiscord<DaiChimpo> ahh
20:24:37FromDiscord<Yardanico> either change the algorithm or copy the sequence and then add to your copy
20:25:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3GIa
20:27:08FromDiscord<DaiChimpo> hmm is there an optimal way to check for duplicates in a seq? something like if seq.contains(token): ?
20:27:37FromDiscord<DaiChimpo> if I can separate that out this loop's algorithm is elementary
20:27:43FromDiscord<Yardanico> ah lol
20:27:53FromDiscord<Yardanico> yeah, you can either just use contains or the nim `in` sugar over `contains`
20:28:05FromDiscord<Yardanico> `if value in seq`
20:28:12FromDiscord<Yardanico> or `if value notin seq` for the reverse
20:28:39FromDiscord<Yardanico> `in` and `notin` operators in nim just map to `contains` procedures, so you can write even write `contains` for your own types and still use `in`
20:28:44FromDiscord<DaiChimpo> these english keywords mess with me
20:29:21FromDiscord<DaiChimpo> earlier got stuck on Advent because I couldn't figure out how to write int mod 4 lol
20:30:07FromDiscord<Yardanico> In reply to @DaiChimpo "earlier got stuck on": https://nim-lang.org/docs/system.html#system-module-numbers :)
20:30:18FromDiscord<Yardanico> specifically the "Also known as (in other languages)" for comparison
20:30:31FromDiscord<DaiChimpo> I tried % and it was giving me errors!
20:30:37FromDiscord<Yardanico> yes, because as I linked it
20:30:39FromDiscord<DaiChimpo> whatever, it's done now and I've learned from it
20:30:41FromDiscord<Yardanico> % is not how it is written in Nim
20:30:50FromDiscord<DaiChimpo> why can't I read table headers
20:30:52FromDiscord<Yardanico> "usage" is nim, third column is other languages https://media.discordapp.net/attachments/371759389889003532/915701503380054047/unknown.png
20:31:28FromDiscord<DaiChimpo> oh yeah I did try to use | earlier in this program too. it's rough.
20:37:37*lumo_e quit (Ping timeout: 252 seconds)
20:52:25PMunch@DaiChimpo, sounds like you and I solved AoC about the same way :P
20:52:32PMunchI used mod 3 though :)
20:53:18FromDiscord<DaiChimpo> ah yeah I did mine a little inefficiently to get an answer quick haha
20:53:28FromDiscord<Yardanico> yeah @PMunch i'll admit i solved it the dumb way with the seq for part 2 :)
20:53:53FromDiscord<DaiChimpo> Mine was an array of 4 values, the ABCD registers, and the loop kept track of which was the dead spot, essentially
20:54:18FromDiscord<DaiChimpo> got some points in a private leaderboard though :happy:
20:55:13FromDiscord<Yardanico> yeah, you can use aoc for "speed programming" to solve tasks fast, and then use it for "clever code" by changing code you made
20:56:49FromDiscord<DaiChimpo> sent a code paste, see https://play.nim-lang.org/#ix=3GIf
20:56:51PMunch@DaiChimpo, aah I see, I kept a rolling window which just had a small array of the window size so I could subtract values as they left the sum
20:57:40FromDiscord<Yardanico> In reply to @DaiChimpo "I saw someone solve": i think it's because it fit _their_ puzzle input
20:57:51PMunchYeah, that doesn't look correct :P
20:57:59FromDiscord<DaiChimpo> fit mine too, must've been a coincidence lol
20:58:14FromDiscord<Yardanico> mine too :D
20:58:19FromDiscord<DaiChimpo> lolll
20:58:20FromDiscord<Yardanico> yeah, maybe an oversight in the puzzle input
20:58:37FromDiscord<Yardanico> they exploited an edge case :P
20:58:44FromDiscord<DaiChimpo> there's too many counterexamples in my head, gotta be coincedences
20:58:54FromDiscord<DaiChimpo> BUT it is a lesson in algorithm optimization
20:58:55FromDiscord<Yardanico> this is clever, but it's kind of cheating and not on the point :P
20:59:08FromDiscord<DaiChimpo> why do more when less do right
20:59:09FromDiscord<Yardanico> it's just solving the task with _specific_ input, not generic-for-anything
20:59:55FromDiscord<DaiChimpo> yeah I think this mainly works because the trend was very steep. if the differences in group sums was like, +/- 5, this would be less likely
21:00:09FromDiscord<DaiChimpo> now I'm gonna be looking for a similar cheat on day 2
21:04:22*lumo_e joined #nim
21:05:49PMunchDamn it.. Works for my input as well..
21:06:41FromDiscord<Yardanico> actual aoc exploit :P
21:06:50FromDiscord<Yardanico> In reply to @DaiChimpo "I saw someone solve": did they post it as a reddit thread?
21:10:29FromDiscord<Zoom> I've finally bent std/pegs to my will for the 18th day of 2020. Made it a challenge to not use 3d party libs
21:11:20FromDiscord<Yardanico> ===restarting the discord-irc bridge, expect a <1 minute downtime===
21:11:21FromDiscord<dain> it isn't a nedge case
21:11:24FromDiscord<Zoom> That `eventParser` in pegs looks a bit clumsy but it gets the job done
21:11:26FromDiscord<dain> (edit) "a nedge" => "an edge"
21:11:28*FromDiscord quit (Remote host closed the connection)
21:12:03*FromDiscord joined #nim
21:12:26FromDiscord<Yardanico> restarted the bridge
21:12:26FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GIk
21:12:41PMunch@Zoom, haha why oh why :P
21:12:48PMunchnpeg is such a nice fit for AoC
21:12:59PMunchHere's my repo by the way: https://github.com/PMunch/aoc2021
21:12:59FromDiscord<dain> so for comparing (a + b + c) to (b + c + d), the b + c is shared between them
21:13:00nrds<R2D299> itHub: 7"Advent of Code 2021 solutions in Nim"
21:13:02FromDiscord<dain> so they cancel out
21:13:06FromDiscord<dain> and you only have to compare a with d
21:13:08FromDiscord<Yardanico> In reply to @dain "so they cancel out": oh, okay
21:13:13FromDiscord<Yardanico> so they made a really clever solution, nice
21:13:32FromDiscord<Zoom> Even this fact barely explains that sub 30s result on the graph
21:14:18Yardanicooh so R2D2 has been writing this stuff in colours since forever
21:14:25FromDiscord<Zoom> I'd say they made a really clever task so all who rushed would be punished for not taking their time to think↵(@Yardanico)
21:14:25Yardanicoguess ircord irc color stripping works after all
21:14:47FromDiscord<Yardanico> In reply to @Zoom "I'd say they made": well, not exactly "punished"
21:14:57FromDiscord<Yardanico> default aoc rules and leaderboard are made for speed programming
21:15:13FromDiscord<Yardanico> generally not caring how code is implemented
21:15:19FromDiscord<Yardanico> of course there are exceptions where things like bruteforce won't work
21:15:22FromDiscord<Yardanico> but not on the starting days
21:15:22PMunchWhy strip them :P
21:15:33FromDiscord<Yardanico> @PMunch discord doesn't have colours :(
21:15:40FromDiscord<Yardanico> for text formatting
21:15:45FromDiscord<Zoom> Feeling real dumb is a fine punishment↵(@Yardanico)
21:16:07FromDiscord<dain> sent a code paste, see https://play.nim-lang.org/#ix=3GIl
21:16:15FromDiscord<Recruit_main707> spoilers!
21:16:19FromDiscord<Yardanico> yep
21:16:22PMunchW11ha13t?03! 05No07 c09ol11ou13rs03!
21:16:25FromDiscord<dain> oh sorry
21:16:26FromDiscord<Yardanico> also we have #aoc
21:16:29FromDiscord<Yardanico> but it's not bridged to matrix
21:16:40FromDiscord<dain> deleted :x
21:16:44FromDiscord<Yardanico> too late
21:16:47FromDiscord<dain> ;-;
21:17:30FromDiscord<Yardanico> irc doesn't have a way to delete messages, so your message is left for everyone to see
21:17:36FromDiscord<Recruit_main707> hehe, well tbh i already have a pretty clear idea of what needs to be done, the problem is im using a stack language and im not used to it at all lol, its been over an hour of thinking how to do something i perfectly know how
21:17:43FromDiscord<Yardanico> although it's a link to a code paste on play.nim-lang.org, so if ix.io goes down your code will disappear
21:21:18ZevvPMunch: last year there were a few natural fits for npeg, like https://github.com/zevv/aoc2020/tree/master/04
21:22:02FromDiscord<Zoom> Does anyone here share their nvim `.vimrc`s? Looking for inspiration, preferably with minimal plugins.
21:22:59FromDiscord<Zoom> Is the nimlsp the way to go?
21:23:22FromDiscord<Yardanico> i've never used nvim but doesn't https://github.com/alaviss/nim.nvim work fine with it?
21:23:24nrds<R2D299> itHub: 7"Nim plugin for NeoVim"
21:23:35FromDiscord<Yardanico> it's a "native" nimsuggest nvim plugin, so it doesn't use nimlsp
21:25:24FromDiscord<Smarc> Hello Guys, I did not found a specialized code review room, so I'm going to try it in here. I'd like to know what I could improve in my code (not in particular linewise, more like the whole lot) and make more the nim way https://github.com/Smarcy/nim_chess
21:25:25nrds<R2D299> itHub: 7"<No Description>"
21:25:49FromDiscord<Yardanico> In reply to @Smarc "Hello Guys, I did": sure, it's fine to post it here, but for more exposure you might also post it on the forum
21:26:03FromDiscord<Smarc> Noted :)
21:26:37FromDiscord<Zoom> It does and that's what I'm using currently↵(@Yardanico)
21:26:52FromDiscord<Yardanico> already a small note - did you do "Board = object of RootObj" because you want to create some objects that will inherit from Board in the future?
21:26:57PMunchZevv, I had four days I used it for. 7, 16, 19, and 21
21:26:59FromDiscord<Yardanico> "of RootObj" is only needed for that
21:27:09FromDiscord<Yardanico> otherwise you can just have "Board = object" and fields below
21:27:35FromDiscord<Smarc> Maybe that was an idea in the beginning, but not anymore. Thank you for the catch
21:28:47FromDiscord<Yardanico> Also, instead of having `Piece` as `ref object` you can have it as `object`, I see you inherit Piece but it'll work the same with `object`. You might want to keep it a `ref` if you plan on using `method`s in the future though (dynamic dispatch)
21:29:12*Jjp137 quit (Quit: Leaving)
21:29:23*Jjp137 joined #nim
21:30:52FromDiscord<Smarc> That is crashing for me, the compiler does not allow inheritance if the base class is not ref of `ref of RootObj`
21:31:10FromDiscord<Yardanico> inheritance will work with `of RootObj` without a ref
21:31:40FromDiscord<Smarc> Ah, I see. What about the several Pieces? Should they be refs for any reason?
21:31:41FromDiscord<Yardanico> ah, right, you're also using `ref` objects for easier mutability
21:32:03FromDiscord<Smarc> I never were really sure if I should use ref or not actually
21:32:05FromDiscord<Yardanico> ooh, also you should never cast like `cast[Rook](sourcePiece)`
21:32:13FromDiscord<Yardanico> this is unsafe, you should use a type-safe conversion instead
21:32:15FromDiscord<Yardanico> like Rook(sourcePiece)
21:32:15FromDiscord<Michal58> In reply to @DaiChimpo "I saw someone solve": Huh, here I am wondering why so many people didn't do it this way..
21:32:24FromDiscord<Yardanico> `cast` is just treating the same bytes as a different type
21:32:48FromDiscord<Smarc> I figured that that would be smelly :D Gonna try it out
21:34:02FromDiscord<Yardanico> hmm
21:34:58FromDiscord<Smarc> I'm getting an error if I change it to `Rook(sourcePiece)`. type mismatch: got queen instead of (rook|bishop) .. huh?
21:35:20FromDiscord<Yardanico> well, because it's kind of unsafe actually
21:35:32FromDiscord<Yardanico> i think that you can convert between the subtype and its parent type
21:35:35FromDiscord<Yardanico> but not between subtypes
21:36:07FromDiscord<Smarc> Okay so the unsafe `cast` is maybe the only sane solution? I mean it should work every time there, I still feel its unsafe
21:36:19FromDiscord<Yardanico> well, it might work every time but it'll remain unsafe
21:36:23FromDiscord<Yardanico> I can easily show you how it's unsafe
21:36:56FromDiscord<Smarc> Thank you, I'm more interested in a code review :)
21:37:25FromDiscord<Yardanico> well, this is kind of a part of the code review :P
21:37:49FromDiscord<Yardanico> ahh i understand why you used casting
21:38:01FromDiscord<Yardanico> you wanted queen code to reuse the same code for bishop and rook
21:38:02FromDiscord<Yardanico> it does make sense, yeah
21:38:16FromDiscord<Smarc> should work every time :s
21:39:52FromDiscord<DaiChimpo> In reply to @dain "so for comparing (a": THANK you. I'm on fifty hours no sleep, this cause was elusive
21:40:09FromDiscord<Yardanico> In reply to @Smarc "should work every time": it will, but it's actually undefined behaviour
21:40:11FromDiscord<Yardanico> "/home/dian/Projects/NimExperiments/nim_chess/src/model/pieces.nim:36:29: runtime error: load of value 49, which is not a valid value for type 'bool'"
21:40:25FromDiscord<Yardanico> because you're reaching memory you actually might not have access to
21:40:35FromDiscord<Smarc> I was able to change the cast into a type-safe variant. I just reassigned sourcePiece to (Piece)sourcePiece beforehand
21:40:49FromDiscord<Smarc> oh, how did you provoke that?
21:41:14FromDiscord<Yardanico> In reply to @Smarc "I was able to": yes, that'll work if you don't need to mutate it in those can move procs
21:41:18FromDiscord<Yardanico> In reply to @Smarc "oh, how did you": I used clang's UBSAN
21:41:57FromDiscord<Yardanico> it won't show that error on your tests because you didn't test for it though
21:42:52FromDiscord<Smarc> yeah, I just started testing in nim a few days ago and am adding some step by step
21:43:52FromDiscord<Yardanico> sent a long message, see http://ix.io/3GIs
21:44:13FromDiscord<Yardanico> so if you access `canCastle` of a `Rook` casted from Queen you might get an access violating, a sigsegv, or something else
21:44:42FromDiscord<Smarc> Does this behaviour happen when I use type-safe casting?
21:44:44FromDiscord<Michal58> I have a quite simple lichens bot written Nim, we can let them play some time. https://github.com/MichalMarsalek/nimbochromis
21:44:44FromDiscord<Yardanico> and in your case that can actually be dangerous because you do ` sourcePiece.canCastle = false` in Rook's checking proc
21:44:45nrds<R2D299> itHub: 7"<No Description>"
21:44:51FromDiscord<Yardanico> In reply to @Smarc "Does this behaviour happen": no, then it'll be safe
21:44:56FromDiscord<Michal58> (edit) "lichens" => "lichess"
21:45:32FromDiscord<Smarc> Okay great, then you already fixed that and thanks a lot for the explanation!
21:45:56FromDiscord<Yardanico> i remember there being a malloc implementation that was specifically crafted to find all sorts of memory-related bugs, can't remember the name
21:46:23FromDiscord<Smarc> Why does a Piece have 32 Bytes, but a Queen only 8, though? And the Rook has one byte more?
21:46:23FromDiscord<Yardanico> but clang's UBSAN also works for most cases
21:46:31FromDiscord<Yardanico> In reply to @Smarc "Why does a Piece": nonon, I meant that data inside the Piece has 32 bytes
21:46:41FromDiscord<Yardanico> piece itself is 8 bytes since it's a reference to that data (on 64-bit)
21:46:45FromDiscord<Yardanico> Queen is the same
21:46:45FromDiscord<iffy (Matt Haggard)> This program's segfault is not a true segfault, right? It's a Nim-emitted "segfault"? https://play.nim-lang.org/#ix=3GIt
21:46:52FromDiscord<Yardanico> and Rook has 8 bytes more because it has an additional field
21:47:00FromDiscord<Smarc> Ahhh, I see
21:47:04FromDiscord<Yardanico> even if it's `bool` objects are aligned by default on most platforms
21:47:09FromDiscord<Yardanico> so 1 byte is aligned to 8 bytes
21:47:19FromDiscord<Yardanico> because that's the native machine word "size" for 64-bit
21:47:27FromDiscord<Smarc> okay, understood
21:49:04FromDiscord<Yardanico> @Smarc about the code itself - I can see a way to make piece_factory code much shorter by using loops
21:49:19FromDiscord<Yardanico> it'll be a tiny bit less efficient, but it doesn't really matter since it's only executed once at the start as I understand
21:49:45FromDiscord<iffy (Matt Haggard)> And same with this "segfault"? https://play.nim-lang.org/#ix=3GIu
21:50:24FromDiscord<Yardanico> In reply to @iffy (Matt Haggard) "This program's segfault is": this just fails because JsonNode is a ref object
21:50:29FromDiscord<Yardanico> and dereferencing a nil ref object is a SIGSEGV
21:50:46FromDiscord<Yardanico> In reply to @iffy (Matt Haggard) "And same with this": same here, Future[T] is a ref object
21:50:46FromDiscord<iffy (Matt Haggard)> But it's Nim that's catching that, right? Not the OS
21:50:56FromDiscord<Smarc> In reply to @Yardanico "it'll be a tiny": I thought about that, just lazyness kept me from refactor it tbh. But is there anything in this code that you would call an anti-nim-pattern or something?
21:51:01FromDiscord<Yardanico> In reply to @iffy (Matt Haggard) "But it's Nim that's": it's OS catching that and reporting it to Nim since Nim has a default signal handler for SIGSEGV
21:51:14FromDiscord<iffy (Matt Haggard)> oh, okay
21:52:28FromDiscord<Yardanico> In reply to @Smarc "I thought about that,": hmm, don't think so, can't see anything bad in the nim code itself
21:52:46FromDiscord<iffy (Matt Haggard)> I'd be interested in adding a compile mode that fails for possible nils during compilation or maybe that disables nils altogether. No, I haven't thought it all the way through \:) I'm just tired of getting those errors.
21:53:01FromDiscord<Yardanico> there's the "return" vs "result" thing, and Nim code usually leans to the "result" side more, but you can use return just as fine
21:53:19FromDiscord<Yardanico> also, @Smarc if you were to use methods you wouldn't need this proc at all https://media.discordapp.net/attachments/371759389889003532/915722248839630869/unknown.png
21:53:37FromDiscord<Yardanico> you'll just have isValidMovePattern for each piece type and since they're methods they'll be dynamically dispatched
21:54:03FromDiscord<Yardanico> but OOP is "kind of" less popular in Nim since it leans towards composition
21:54:36FromDiscord<Yardanico> In reply to @iffy (Matt Haggard) "I'd be interested in": there was an experimental notNil feature that was never finished really
21:54:43FromDiscord<Yardanico> it might get finished for 2.0 though :) https://github.com/nim-lang/RFCs/issues/437
21:54:59FromDiscord<Yardanico> https://nim-lang.org/docs/manual_experimental.html#not-nil-annotation
21:55:16FromDiscord<Smarc> Well, I'm coming from Java, I think you can see that from some structural attributes. :)↵What do you mean by using method? I don't really understood what it differs from proc yet
21:55:18FromDiscord<Yardanico> it's an experimental feature though, so it might break anywhere or crash your compiler
21:55:29FromDiscord<Yardanico> In reply to @Smarc "Well, I'm coming from": basically nim `proc`s are static dispatch
21:55:37FromDiscord<Yardanico> the compiler figures out which proc you are actually calling at compile time
21:55:43FromDiscord<Yardanico> by checking the (static) type of the variable
21:56:09FromDiscord<Yardanico> with methods it uses runtime dispatch - it finds the best suited method to call for that type and calls it
21:56:23FromDiscord<Yardanico> so basically runtime dispatch is the java way
21:56:44FromDiscord<Yardanico> you might've seen "static" methods in java - those are actually static dispatch
21:58:02FromDiscord<Yardanico> @Smarc see https://nim-lang.org/docs/manual.html#methods for some documentation on methods
21:58:25FromDiscord<Yardanico> also https://nim-lang.org/docs/tut2.html#object-oriented-programming
21:59:13FromDiscord<Smarc> Hm, I'm getting an error if I remove the cast and change the proc to method. I shall add {.base.} to the method, which results in a `this method is not a base`
21:59:30FromDiscord<Yardanico> In reply to @Smarc "Hm, I'm getting an": you need to define a base method for the `Piece`
21:59:37FromDiscord<Yardanico> base methods are the ones that are defined on the base type
22:00:04FromDiscord<Yardanico> and in that method you can write an error or something if you don't intend to actually have that logic implemented for `Piece`
22:02:36FromDiscord<iffy (Matt Haggard)> Maybe `notnil` doesn't work with inheritance? https://play.nim-lang.org/#ix=3GIA
22:03:58FromDiscord<Yardanico> In reply to @iffy (Matt Haggard) "Maybe `notnil` doesn't work": it emits a warning though
22:03:59FromDiscord<Yardanico> `/home/dian/Projects/NimExperiments/aoc/2021/what.nim(4, 29) Warning: Cannot prove that 'result' is initialized. This will become a compile time error in the future. [ProveInit]`
22:04:15FromDiscord<Yardanico> did you maybe miss it?
22:04:45FromDiscord<iffy (Matt Haggard)> oh, the playground doesn't show compile warnings \:)
22:05:11FromDiscord<iffy (Matt Haggard)> Unless you click that button. Okay, yes, I see it. That's great! This is what I want
22:05:41FromDiscord<Elegantbeef> @apahl\: did i say they were copied passing to a proc, that seems very wrong and i must've been dumb in that minute 😜
22:06:02FromDiscord<iffy (Matt Haggard)> Well, I want a way to add a `not nil` annotation to JsonNode and Future, too (enabled with a flag is fine). Maybe that's the part I can contribute
22:06:40FromDiscord<Yardanico> the thing is that the patch won't get accepted
22:06:46FromDiscord<Yardanico> precisely because not nil is an experimental feature
22:06:58FromDiscord<bananahead> Hi all, are there any good docs explaining differences between procs and funcs? Not sure I understand the difference.
22:07:07FromDiscord<iffy (Matt Haggard)> Even if it's only enabled explicitly?
22:07:08FromDiscord<Yardanico> there's actually a different implementation of notnil in nim that's newer and also experimental - https://nim-lang.github.io/Nim/manual_experimental_strictnotnil.html
22:07:23FromDiscord<Yardanico> In reply to @bananahead "Hi all, are there": funcs are just `proc`s with `{.noSideEffect.}`
22:07:38FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#procedures-func, and for the noSideEffect itself - https://nim-lang.org/docs/manual.html#effect-system-side-effects
22:07:43FromDiscord<Elegantbeef> No side effect means the procedure cannot touch global state
22:08:42FromDiscord<Yardanico> so if you use `func` you tell the compiler that the routine doesn't access global state, and if that's not the case, it'll show you an error
22:08:45FromDiscord<Yardanico> and refuse to compile the code
22:09:23FromDiscord<Elegantbeef> There's also the lovely experimental `strictFuncs` which prevents mutation of even `ref T` without `var`
22:09:38FromDiscord<iffy (Matt Haggard)> So if a patch won't be accepted, is my only option at this point to `type MyJsonNode = JsonNode not nil` in my own code and convert from `MyJsonNode` back to `JsonNode` for other things to use?
22:09:48FromDiscord<iffy (Matt Haggard)> And same with `Future`s?
22:10:10FromDiscord<iffy (Matt Haggard)> I think Futures are too invasive for it to be practical to have my own `not nil` version
22:10:37FromDiscord<bananahead> Oh thats good. So funcs are analogous to pure functions in a way, only modifying the function input .
22:11:25FromDiscord<Elegantbeef> Yea that's their goal
22:11:34FromDiscord<Elegantbeef> hence `func` instead of \`proc1
22:11:43FromDiscord<iffy (Matt Haggard)> gtg, but thanks for pointing me in the right direction, Yardanico. Good luck with AoC \:)
22:11:55FromDiscord<Yardanico> thanks :P
22:12:23PMunchI think maybe proc and func needs to be documented a bit better. Seems multiple people are confused about them
22:13:14FromDiscord<Elegantbeef> Be the change you want to see in the world pmunch 😛
22:13:20FromDiscord<bananahead> In reply to @Elegantbeef "hence `func` instead of": Yeah so generally funcs should be preffered over procs I guess.
22:14:26FromDiscord<Elegantbeef> Yep, Nim also will implicitly mark procs as `noSideEffect` if they dont have any side effect
22:15:37FromDiscord<Elegantbeef> Which might seem pointless but if you do someting like `var someEvent = somePureProc` you cannot reassign `someEvent` to a proc with a side effect
22:15:42FromDiscord<Elegantbeef> Without type conversions of course
22:15:53*neurocyte0132889 quit (Ping timeout: 252 seconds)
22:17:19FromDiscord<bananahead> Ahh that's good to know. Thank you @ElegantBeef
22:17:46PMunch@Elegantbeef, hmm I guess
22:19:36FromDiscord<Elegantbeef> Hey if i dont make shitty jokes what'll get done?!
22:22:02FromDiscord<Yardanico> [Zoom](https://matrix.to/#/@Zoom:matrix.org)\: AoC is now bridged to #nim-aoc\:matrix.org
22:22:08FromDiscord<Yardanico> feel free to join it for AoC discussions
22:22:44FromDiscord<Yardanico> (us mere mortals in Discord already have #aoc if anyone missed it)
22:23:19anddamYardanico: thanks for the info earlier. I got the cimgui dynamic lib working, so I can use nim with C backend and nimgl/imgui
22:23:26FromDiscord<Yardanico> nice
22:23:44anddamYardanico: not really clear how to statically link the lib, I placed libcimgui.a near test.nim then ran
22:24:03anddamnim c --dynlibOverride:cimgui --passC:libcimgui.a --passL:-L. --passL:-lcimgui test.nim
22:24:19PMunchHmm, just to figure out where to put it..
22:24:33anddamactually I am not even sure I should pass -L -l for a static lib, rather than just passing the archive to the compiler
22:24:39PMunch@bananahead, where would you have expected to find the proc/func difference definition
22:24:41anddamso just --passC in my case
22:24:43Yardanicoanddam: you don't need passC and -L here
22:24:45Yardanicojust the last passL
22:24:49Yardanicoand did it error out or work?