<< 26-05-2020 >>

00:07:49*NimBot joined #nim
00:11:06*Guest61421 quit (Ping timeout: 256 seconds)
00:15:39*dadada joined #nim
00:16:02*dadada is now known as Guest5889
00:23:13FromDiscord<Technisha Circuit> ~~Is there a brainfuck to nim interpreter?~~
00:23:23Yardanicohttps://github.com/def-/nim-brainfuck
00:23:25FromDiscord<Technisha Circuit> (edit) 'brainfuck' => 'nim' | 'nim' => 'BrainFuck'
00:23:34FromDiscord<Technisha Circuit> I meant the other way rounf
00:23:36FromDiscord<Technisha Circuit> Round*
00:23:45Yardanicosearch for "c to brainfuck"
00:23:49Yardanicoor "js to brainfuck"
00:23:56Yardanicoif you find something - then you can maybe use it with nim
00:30:47FromDiscord<exelotl> C -> brainfuck -> Nim
00:30:54FromDiscord<exelotl> nimterop is solved
00:30:54Yardaniconah
00:31:02Yardanicowhat he wants is Nim -> C -> brainfuck :D
00:32:56Yardanicobtw, is there a way to have doc comments for different branches of an object variant?
00:41:48FromDiscord<codic> how do I get an iterable object (seq or array) out of the contents of a directory?
00:42:17FromDiscord<codic> i'm trying to get all assets auto served for my jester site (if there's a better way, lemme know)
00:45:03Yardaniconginx
00:45:13Yardanicoand make it understand the folder like "/public"
00:51:17*gangstacat quit (Quit: Ĝis!)
00:53:55FromDiscord<codic> nginx isn't nim..
00:54:29FromDiscord<codic> ah. there's os.walkDir and walkDirRec
00:54:51*Guest5889 quit (Ping timeout: 265 seconds)
00:55:01Yardanicodid some progress on my tl scheme definition -> nim types :P
00:55:02Yardanicohttps://gist.github.com/Yardanico/dd5f0d564fe371eab62ea59441d1d1ef
00:55:13Yardanico(that file has a few hand modifications but it actually works)
00:56:22*lritter quit (Ping timeout: 256 seconds)
00:57:16*lritter joined #nim
00:57:25*avatarfighter joined #nim
00:58:45FromDiscord<codic> aw, does anyone know why nim says get is undeclared inside the for block here? https://hatebin.com/gimqwsnnmj
00:58:56*muffindrake joined #nim
00:59:13Yardanicouhh that's not how it works really
00:59:26Yardanicojester transforms all routes at compiletime
01:00:30FromDiscord<codic> oh. welp :/
01:00:31*dadada joined #nim
01:00:49FromDiscord<codic> so how would i do it instead?
01:01:13*dadada is now known as Guest14341
01:06:04bung_route your asset as pattern match
01:06:39bung_no need recursivly loop your assets dir
01:13:37bung_in production you just need nginx
01:18:39*gangstacat joined #nim
01:22:07*chemist69 quit (Ping timeout: 260 seconds)
01:24:06*chemist69 joined #nim
01:24:14*Guest14341 quit (Ping timeout: 240 seconds)
01:30:41*dadada__ joined #nim
01:36:52FromDiscord<codic> could you show an example?
01:38:40FromDiscord<codic> @FromIRC:bung_
01:39:37Yardanicoyou don't need to ping him like that
01:39:53Yardanicoon IRC highlights are client-side so you just need to have "bung_" somewhere in your message usually
01:43:09*endragor joined #nim
01:43:17*nphg joined #nim
01:44:54FromDiscord<codic> ah, alright.
01:45:36*nphg1 quit (Ping timeout: 265 seconds)
01:47:16*oz` joined #nim
01:48:33*oz quit (Quit: EOF)
01:48:34*oz` is now known as oz
01:52:39bung_some example https://github.com/bung87/nginx_supervisor_tornado/blob/master/etc/nginx/nginx.conf
01:54:46*dadada__ quit (Ping timeout: 260 seconds)
01:56:10bung_I checked the jester readme you can just using regex as route pattern
01:56:25FromDiscord<codic> > route your asset as pattern match↵I was talking about this, I'm not sure how to do this. do I need the whole nginx?
01:56:32FromDiscord<codic> just for this small thing?
01:56:44Yardanicono
01:56:52Yardanicohttps://github.com/dom96/jester#regex
01:57:25bung_yeah if you just play for fun using regex is fit your case
01:58:09avatarfighterIs there a way to verify if the future of AsyncHttpClient.downloadFile has completed?
01:58:11FromDiscord<codic> Do you have an example though?
01:58:42avatarfighterMy callbacks to the future from downloadFile don't seem to be calling when the file is done downloading so I'm not sure what to do
01:59:04Yardanicoavatarfighter: there's a finished proc
01:59:12Yardanicohttps://nim-lang.org/docs/asyncfutures.html#finished
01:59:28Yardanicoalso how do you start the future itself?
01:59:39Yardanicomaybe it throws an exception but it's just swallowed if you have a custom callback
01:59:44bung_I dont have
02:00:08bung_another option , if you'd like serve your assert in another server
02:00:10bung_https://github.com/h3rald/nimhttpd
02:00:18avatarfighterYardanico: I'm starting the future itself by awaiting the downloadFile proc I don't know if that's the correct thing to do
02:00:34*dadada__ joined #nim
02:04:18*wowaname joined #nim
02:05:43avatarfighterok nevermind the futures do complete, I managed to write a while loop that never loops lmao
02:07:35*opal quit (Quit: i'm never coming back)
02:10:29Yardanicook made my nigram repo public - https://github.com/Yardanico/nigram - no readme yet, code is in a pretty rough shape for now :)
02:10:41Yardanicothe generated file itself is https://github.com/Yardanico/nigram/blob/master/src/tdlib_types.nim by the way
02:10:54*wowaname quit (Quit: i'm never coming back)
02:12:43*opal joined #nim
02:15:14bung_why named it nigram, looks like search engine technic...
02:15:20Yardanicobung_: ?
02:15:23Yardaniconim + telegram = nigram
02:15:34bung_lol
02:15:36Yardanicoi can rename it later
02:15:59FromDiscord<codic> so with jester, can i use a wildcard like `/*.png`?
02:16:05Yardanicowith regex - sure
02:16:22FromDiscord<codic> howd that look?
02:17:37*Senketsu quit (Ping timeout: 264 seconds)
02:18:00FromDiscord<codic> i'd guess `get re"/.\.png/": resp(readFile(request.matches[0]))` or something? but idk
02:19:12bung_you may jusst need ^assets/
02:20:10FromDiscord<codic> but what about everything after the colon? the response?
02:20:15bung_then send whatever file under that dir, also given a mime type
02:20:44bung_that's basic static server logic
02:20:56FromDiscord<codic> `get re"^assets/": resp(readFile(request.matches[0]))`
02:21:23FromDiscord<codic> oh wait!
02:21:26FromDiscord<codic> sent a long message, see http://ix.io/2nmg
02:21:26FromDiscord<codic> that solves my problem
02:21:42Yardanico:P
02:22:24bung_oh there's public dir , then it be simple.
02:23:01FromDiscord<codic> aaaaaand it works well!
02:23:11FromDiscord<codic> wait, i have a crazy idea
02:23:35FromDiscord<codic> could i use setStaticDir and pass `.` for the current directory, to auto load html files as well?
02:23:59Yardanicowell they are static files aren't they
02:24:18FromDiscord<codic> yup
02:24:37bung_that depends whether it expand the path to absolute path
02:24:47*dadada__ quit (Ping timeout: 260 seconds)
02:30:40*dadada joined #nim
02:31:03*dadada is now known as Guest70920
02:31:12*muffindrake quit (Ping timeout: 260 seconds)
02:33:28*muffindrake joined #nim
02:46:42*avatarfighter quit (Ping timeout: 260 seconds)
02:54:30*Guest70920 quit (Ping timeout: 258 seconds)
02:57:37FromDiscord<Ahlin Chan> how to check if a method exists in `type`
02:58:35FromDiscord<Ahlin Chan> sent a code paste, see http://ix.io/2nml
03:00:02FromDiscord<Ahlin Chan> sent a code paste, see https://discordapp.com/channels/371759389889003530/371759389889003532/714674174756388897
03:00:34FromDiscord<flywind> sent a code paste, see http://ix.io/2nmm
03:00:35*dadada joined #nim
03:01:13*dadada is now known as Guest14223
03:01:17FromDiscord<Ahlin Chan> is there a wat instead of catching the errors ?
03:01:23FromDiscord<Ahlin Chan> (edit) 'wat' => 'way'
03:01:44FromDiscord<Elegant Beef> Listen to your compiler 😄
03:04:40FromDiscord<Ahlin Chan> okay thanks, i'm always looking for best way to achieve something.
03:08:35FromDiscord<Ahlin Chan> https://media.discordapp.net/attachments/371759389889003532/714676327332053002/unknown.png
03:08:39FromDiscord<Ahlin Chan> alright
03:09:32FromDiscord<Elegant Beef> You're using json for packets and have a proc for a specific json type?
03:10:11FromDiscord<Ahlin Chan> sent a code paste, see http://ix.io/2nmp
03:10:17FromDiscord<Ahlin Chan> (edit) 'http://ix.io/2nmp' => 'http://ix.io/2nmq'
03:10:21FromDiscord<Ahlin Chan> (edit) 'http://ix.io/2nmq' => 'https://discordapp.com/channels/371759389889003530/371759389889003532/714676720955031644'
03:10:53FromDiscord<Ahlin Chan> sorry about the pic above that was my mistake
03:11:07FromDiscord<Ahlin Chan> i compiled it again
03:11:07FromDiscord<Elegant Beef> What are you apolgizing about?
03:11:19FromDiscord<Ahlin Chan> about the ununsed var
03:11:22*nermik joined #nim
03:11:31FromDiscord<Elegant Beef> Oh go the humanity!
03:11:33FromDiscord<Elegant Beef> (edit) 'go' => 'god'
03:19:52*avatarfighter joined #nim
03:21:14*Tongir joined #nim
03:23:46*Tlanger quit (Ping timeout: 256 seconds)
03:23:55*chemist69 quit (Ping timeout: 272 seconds)
03:24:24*Guest14223 quit (Ping timeout: 258 seconds)
03:24:32*chemist69 joined #nim
03:30:11*silvernode joined #nim
03:30:38*dadada__ joined #nim
03:32:48*avatarfighter quit (Remote host closed the connection)
03:32:59*avatarfighter joined #nim
03:38:37*avatarfighter quit (Ping timeout: 260 seconds)
03:39:23*silvernode quit (Quit: Leaving)
03:39:39*nermik quit (Ping timeout: 245 seconds)
04:03:33*avatarfighter joined #nim
04:06:01*supakeen quit (Quit: WeeChat 1.9.1)
04:06:42*supakeen joined #nim
04:31:21bung_how to test async server? can be done in same process?
04:53:43*waleee-cl quit (Quit: Connection closed for inactivity)
04:59:45*greenfork joined #nim
05:05:28FromDiscord<Elegant Beef> Can nim archive create a zip file, i know it has a bunch of low level exposed logic, but uncertain if it does make archives?
05:11:27bung_ zip lib has the api
05:26:25*zacharycarter joined #nim
05:30:50*zacharycarter quit (Ping timeout: 260 seconds)
05:32:02*dddddd quit (Ping timeout: 260 seconds)
05:32:04*xet7 quit (Quit: Leaving)
05:38:18*dadada__ quit (Ping timeout: 260 seconds)
05:45:41*dadada joined #nim
05:46:04*dadada is now known as Guest66426
05:48:02*xet7 joined #nim
05:56:33*lritter quit (Quit: Leaving)
06:09:37*Guest66426 quit (Ping timeout: 258 seconds)
06:14:45shashlickYes libarchive can do anything with archives
06:15:25shashlickHigh level Nim api isn't available yet but you can port any existing libarchive example
06:15:35*dadada joined #nim
06:16:02*dadada is now known as Guest78892
06:24:13*tdc joined #nim
06:27:31*solitudesf joined #nim
06:27:32*Faulander quit (Read error: Connection reset by peer)
06:27:59*Faulander joined #nim
06:34:18*FromDiscord quit (Remote host closed the connection)
06:34:33*FromDiscord joined #nim
06:39:12*Guest78892 quit (Ping timeout: 256 seconds)
06:41:26*endragor quit (Remote host closed the connection)
06:45:37*dadada__ joined #nim
06:55:35*fredrikhr joined #nim
06:56:11*endragor joined #nim
06:59:36*liblq-dev joined #nim
07:07:30*avatarfighter quit (Quit: Leaving)
07:09:27*dadada__ quit (Ping timeout: 260 seconds)
07:15:37*dadada joined #nim
07:16:02*dadada is now known as Guest25955
07:19:46*Tlanger joined #nim
07:22:31*Tongir quit (Ping timeout: 260 seconds)
07:28:18FromDiscord<jasonfi> for zero-copy string slices which issue # can I track?
07:28:35FromDiscord<jasonfi> there's an RFC: https://github.com/nim-lang/RFCs/issues/12
07:28:36disbot[RFC] View/slice
07:28:43*B4s1l3 joined #nim
07:28:54*B4s1l3 is now known as opDispatch
07:29:11FromDiscord<jasonfi> but does issue #178 cover string slices?
07:29:18FromDiscord<jasonfi> mentioned at the end of the RFC
07:32:47leorizeyes it will
07:32:59leorizein fact there's a limited version of it that you can use atm
07:33:10leorizetoOpenArray() allows zero-copy slices
07:35:55*Vladar joined #nim
07:37:58*arecaceae joined #nim
07:39:49*Guest25955 quit (Ping timeout: 264 seconds)
07:43:21FromDiscord<jasonfi> ok thanks
07:45:40*dadada__ joined #nim
08:09:31*dadada__ quit (Ping timeout: 256 seconds)
08:11:25*sschwarzer joined #nim
08:11:57*sschwarzer quit (Client Quit)
08:13:46*PMunch joined #nim
08:15:37*dadada joined #nim
08:16:02*dadada is now known as Guest62594
08:18:04PMunchHmm, this program I'm interfacing with is calling a `deinit` procedure when it's done with the DLL. Is there something I should call in Nim to free all the memory it has taken up? GC_fullcollect only free unused memory, but I want to clean up absolutely everything.
08:30:09FromDiscord<Synth> Hello, I'm sorry but may I get some quick help? I am trying to convert a float into float64... how am I able to achieve this?
08:32:52FromDiscord<Rika> theFloat.float64 @Synth
08:33:32FromDiscord<Synth> Ohh thank you
08:33:56Zevvor float64(theFloat), whichever you prefer
08:35:24*neceve joined #nim
08:35:29PMunchOr `float64 theFloat` for that matter
08:35:46PMunchAlthough I personally prefer `theFloat.float64`
08:36:14FromDiscord<Synth> Thanks!
08:38:32PMunchThis goes for any valid type conversion by the way
08:39:13*Guest62594 quit (Ping timeout: 246 seconds)
08:44:21PMunchHmm, so for NimScript paramCount and paramStr is the same as the ones that Nim gets fed?
08:45:13liblq-devPMunch: FYI `theFloat.float64` doesn't work that well with generic instantiations
08:45:27PMunchWhat do you mean?
08:45:31*dadada__ joined #nim
08:45:33liblq-devsometimes it can glitch out and tell you that `theFloat` does not have a field `float64`
08:45:41liblq-devand you have to use `float64(theFloat)`
08:45:47PMunchAh, yeah that's the only time I tend to use that syntax
08:45:52liblq-devsame
08:48:02FromDiscord<Synth> I'm sorry, maybe I get help again? I'm trying to make a progress bar's value change inside a for loop via onButtonClick event but it's telling me that the variable progressbar is immutable although it's declared as a `var`... example can be seen here: https://github.com/trustable-code/NiGui/blob/master/examples/example_02_controls.nim
08:48:24FromDiscord<Rika> what line
08:49:33FromDiscord<Synth> On line 26, see how it has: `progressBar.value = 0.5`?
08:49:55FromDiscord<Synth> I want to change the value as it iterates inside a forloop. However, it's telling me that it's immutable
08:50:51FromDiscord<Rika> uh
08:50:56FromDiscord<Rika> no idea 😛
08:51:48FromDiscord<Synth> ;-;
08:52:02FromDiscord<Synth> Should I open an issue?
08:52:26FromDiscord<Synth> I tried declaring the value as a mutable variable and then changing that afterwards but didn't work either
08:54:46FromDiscord<Rika> hm
08:54:55FromDiscord<Rika> you might just be using it wrongly 😛
08:55:29FromDiscord<Synth> Hmm...
08:55:36FromDiscord<Synth> I don't think I am...
08:55:41FromDiscord<Synth> I'm opening an issue haha
08:57:52PMunchSynth, do you have a code snippet?
08:58:35PMunchLooking at this Reddit thread I'm wondering why NimScript doesn't wrap `paramCount` and `paramStr` in a more sensible way: https://www.reddit.com/r/nim/comments/gqjuaf/nimscript_struggles_invalid_integer/
08:59:30PMunchIt should be trivial to have it only count arguments to the script, and not to nim itself..
09:00:16*Tongir joined #nim
09:02:40*Tlanger quit (Ping timeout: 246 seconds)
09:03:11*kenran joined #nim
09:09:13*dadada__ quit (Ping timeout: 264 seconds)
09:09:21*abm joined #nim
09:10:51*Vladar quit (Quit: Leaving)
09:14:51*leorize quit (Quit: WeeChat 2.7.1)
09:15:36*dadada joined #nim
09:16:02*dadada is now known as Guest86196
09:17:18*leorize joined #nim
09:21:18FromDiscord<él liquido> https://media.discordapp.net/attachments/371759389889003532/714770119498137610/unknown.png
09:21:21FromDiscord<él liquido> I like how nim doc preserves my alignment
09:25:31FromDiscord<flywind> When you don't have comments, it doesn't preserve alignment.
09:26:12FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/714771357958799471/unknown.png
09:29:40FromDiscord<Rika> strip trailing whitespace T_T
09:32:15FromDiscord<flywind> Striping trailing whitespace has the same result. It needs more hacks to get result as below.
09:32:20FromDiscord<flywind> https://media.discordapp.net/attachments/371759389889003532/714772899805790228/unknown.png
09:32:54FromDiscord<Rika> i was just criticizing
09:33:03FromDiscord<Rika> not saying it would fix the issue
09:34:59FromDiscord<él liquido> @flywind just document your code well :kappa:
09:35:07FromDiscord<él liquido> how'd you achieve that result?
09:35:14FromDiscord<él liquido> manually edited the HTML?
09:38:46FromDiscord<flywind> @él liquido I don't do it. My friend tulayang use `javascript` to adjust output format. It is used by `netkit`.
09:39:18*Guest86196 quit (Ping timeout: 258 seconds)
09:40:25FromDiscord<flywind> https://github.com/iocrate/netkit/tree/master/tools/docplus
09:43:01FromDiscord<flywind> It relays on nodejs.
09:45:40*dadada__ joined #nim
09:46:22PMunchThat's why I believe we should develop the jsondoc further
09:46:42PMunchThat way it would be trivial to create other kinds of doc representations
09:46:54PMunch(although it wouldn't be able to copy in-code alignment)
09:56:28*fredrikhr quit (Ping timeout: 256 seconds)
10:09:07*disruptek quit (Ping timeout: 260 seconds)
10:09:30*disbot quit (Ping timeout: 256 seconds)
10:12:29*disruptek joined #nim
10:12:57*disbot joined #nim
10:20:48*Tlanger joined #nim
10:23:32*Tongir quit (Ping timeout: 272 seconds)
11:11:25*Vladar joined #nim
11:13:01*Senketsu joined #nim
11:20:46*fredrikhr joined #nim
11:26:02*dddddd joined #nim
11:34:20*hvn joined #nim
11:40:35PMunchIs there any ETA on the next Nim version? Even a super rough one?
11:41:17FromDiscord<Rika> idk but theyre scheduled afaik
11:41:34PMunchIt looks a bit iffy to have `choosenim devel` in my Nim builder docker container that builds our production code..
11:41:52PMunchBut I need the fixes I applied to OpenSSL
11:42:57*Vladar quit (Remote host closed the connection)
11:43:14*Vladar joined #nim
11:44:07FromDiscord<Rika> backport when
11:44:31PMunchYeah I guess I could
11:54:06*zacharycarter joined #nim
11:58:22*zacharycarter quit (Ping timeout: 246 seconds)
12:06:01*supakeen quit (Quit: WeeChat 1.9.1)
12:06:41*supakeen joined #nim
12:22:55liblq-devsometimes I really like that Nim has the convenience consts `on` and `off`
12:27:29*zacharycarter joined #nim
12:31:37*zacharycarter quit (Ping timeout: 246 seconds)
12:32:05PMunchHmm, anyone remember the thing that allows you to not retype your generics over and over?
12:38:41*endragor quit (Remote host closed the connection)
12:39:18alehander92just not typing `[]` ?
12:39:33alehander92proc a(b: seq): int = ..
12:41:39PMunchThat can be a seq of anything though
12:42:07PMunchI have a type "Cache[X, Y, strat: static[CacheStrategy]]" and I want to not have to type all that
12:42:25alehander92does `using` work?
12:42:28alehander92with generics
12:42:49alehander92you can also just write .. a template which aliases it
12:44:24PMunchHmm, using was the one I was thinking about
12:45:41alehander92yeah its good
12:46:25PMunchHmm, doesn't seem to work with generics: https://play.nim-lang.org/#ix=2nog
12:49:13*dadada__ quit (Ping timeout: 265 seconds)
12:50:47*dadada joined #nim
12:51:11*dadada is now known as Guest37650
12:51:30alehander92then you can use template
12:54:32liblq-devare hashes guaranteed to be consistent across different builds?
12:57:35liblq-devnvm it doesn't matter for me anyways
12:57:44PMunchalehander92, a template?
12:57:49liblq-devafter rethinking this
12:59:34alehander92well
12:59:40alehander92which just returns the type name
12:59:52alehander92so you just write `test: t()`
13:03:32*Senketsu quit (Ping timeout: 260 seconds)
13:04:14FromDiscord<Technisha Circuit> Is it possible to import a file from a variable?
13:04:28FromDiscord<Recruit_main707> why?
13:05:41alehander92only from compile time variable
13:05:55alehander92otherwise, "why" indeed :)
13:06:04FromDiscord<Technisha Circuit> > why?↵@Recruit_main707 for my Dimscord command handler
13:08:09*zacharycarter joined #nim
13:35:08*couven92 joined #nim
13:35:08*fredrikhr quit (Disconnected by services)
13:35:14*couven92 is now known as fredrikhr
13:36:02FromDiscord<Yardanico> Yes, just pass a static compile time string to a macro which makes an import statement
13:40:09*couven92 joined #nim
13:40:47*fredrikhr quit (Disconnected by services)
13:40:52*couven92 is now known as fredrikhr
13:41:08*couven92 joined #nim
13:43:32*kenran quit (Quit: leaving)
13:44:44*FromDiscord quit (Remote host closed the connection)
13:45:00*FromDiscord joined #nim
13:47:45*fredrikhr quit (Disconnected by services)
13:47:50*couven92 is now known as fredrikhr
13:48:10*couven92 joined #nim
13:49:02*couven92 quit (Read error: Connection reset by peer)
14:08:35PMunchWhy can't I use my X generic here? https://play.nim-lang.org/#ix=2noD
14:09:29Araqgood question
14:10:41*couven92 joined #nim
14:15:02Yardanicois it a limitation of how much analysis the compiler can do for this case? https://gist.github.com/Yardanico/a5ea2070abf0e1bbf261a4d494c8d94c
14:15:46YardanicoI mean it's just a minor thing, I can always just write "default(mytype)" after the call which will raise
14:16:38Yardanicoah right, I can just annotate proc with noreturn explicitly
14:17:46*AliceT joined #nim
14:19:45*fredrik92 joined #nim
14:20:02*fredrik92 quit (Remote host closed the connection)
14:21:12FromDiscord<Rika> what happens if you overload `default`? ive always wondered
14:21:14*hvn quit (Ping timeout: 240 seconds)
14:21:40Yardanicoas you would expect
14:21:46Yardanicoyou'll shadow the default "default" :P
14:21:53FromDiscord<Pat> Nim is a straight up beast... 🎙️
14:22:07*AliceT quit (Client Quit)
14:22:08Yardanicohttps://play.nim-lang.org/#ix=2noJ
14:22:40Yardanicoremove default proc -> it becomes 0
14:23:05Yardanicoof course it will only work in the current module, not in system or somewhere else
14:23:18YardanicoI mean if system calls default for int it'll still get 0 probably
14:23:37*couven92 quit (Ping timeout: 264 seconds)
14:23:42PMunchYeah, it doesn't override the actual default value: https://play.nim-lang.org/#ix=2noK
14:24:13PMunch@Pat, anything in particular you were thinking about?
14:29:31Yardanicouhh lol
14:30:06PMunchUhm..
14:30:16PMunchI have an iterator in a library
14:30:18Yardanicoseems like I found another destructors bug :P
14:30:28PMunchIt accesses a DoublyLinkedList from an object and iterator over those in order
14:30:31Yardanicoat least this time it's not related to leaks/,memory
14:30:47PMunchNow in my test I try to use this iterator, but I have to import the "lists" module for it to work..
14:31:27*zacharycarter quit (Ping timeout: 256 seconds)
14:32:16PMunchThe curious think is that nimlsp doesn't see the error, and when I add the import it says that the import is unused :P
14:32:22FromDiscord<Rika> sounds like a bug or something\
14:32:39YardanicoPMunch: oh yeah, sometimes the unused import warning is incorrect
14:33:13PMunchBut it should still be invalid right?
14:33:28PMunchErr, it should still have worked without importing the lists module right?
14:33:37PMunchI include the lists module where I create the iterator
14:38:52disruptekPMunch: no, it shouldn't have worked.
14:39:09disruptekwait, what?
14:39:11YardanicoPMunch: if you want it to work you need to import lists and export lists
14:39:19Yardanicooh, an iterator
14:39:22disruptekyou created the iterator?
14:39:24Yardanicohmm, maybe due to the fact that they're inlined?
14:39:43disruptekshouldn't matter.
14:40:18disruptekcan we see some code?
14:42:19PMunchOf course, here is the iterator: https://github.com/PMunch/nim-cache/blob/master/src/cache.nim#L105, and here I use it: https://github.com/PMunch/nim-cache/blob/master/tests/test1.nim#L91
14:42:25*waleee-cl joined #nim
14:42:49PMunchNotice on line 5 in the test file I import the lists module
14:43:00PMunchWithout it the test fails to compile on that line
14:43:55disruptekx.items
14:44:39disruptekit's madness to rely upon implicit items/pairs, imo.
14:44:42Yardanicodisruptek: why?
14:44:53disruptekfor exactly this reason.
14:45:06Yardanicofor loops wouldn't exactly be so attractive if pairs/items weren't available implicitly
14:45:14disruptekhow sad for you.
14:45:20PMunchSame error with .items
14:45:24PMunchI already tried that
14:45:43disrupteki don't believe you. 😁
14:45:53PMunchThen download the repo and try yourself :P
14:46:07PMunchI literally just tried it
14:46:42PMunchhttp://ix.io/2noP
14:47:13PMunchAnd I agree with Yardanico, implicit is very nice
14:49:32disrupteklooks to me like the error message is correct.
14:49:42Yardanicodisruptek: it's not though? at all
14:49:52Yardanicocache.nim actually imports lists
14:50:00Yardanicobut test1.nim doesn't
14:50:02disruptekDoublyLinkedList entries are DoublyLinkedNodes.
14:50:07disruptekrtfm
14:50:17PMunchYeah, so?
14:50:31Yardanicodisruptek: I don't really understand why exactly you're trying to argue about this, sorry :)
14:50:31PMunchThat's why I call .value on it in my iterator..
14:50:59disruptekoh, i didn't see this cache.nim iteration.
14:51:23Yardanicodisruptek: https://nim-lang.org/docs/lists.html#items.i%2CSomeLinkedList%5BT%5D
14:51:27PMunchI have a list in my object, I want to expose an iterator for my object. I iterate over the DoublyLinkedList in my iterator and yield the values..
14:51:54PMunchBut to use this iterator I need to import the lists module
14:52:14disruptekrequired type for cache: items.X items.Y ???
14:52:22PMunchHuh?
14:52:40disruptek required type for cache: Cache[items.X, items.Y, items.strat]
14:52:52PMunchWhat are you trying to do?
14:53:58disruptektrying to understand this error message.
14:55:14PMunchHere is a more minimal test that shows the error: http://ix.io/2noS
14:56:22PMunchOh right, that "required type for cache: Cache[items.X, items.Y, items.strat]" just shows you the iterator it just called
14:56:35disruptekyeah.
14:56:38PMunchThis one "minimal.nim(13, 14) template/generic instantiation of `items` from here"
14:57:03disruptekthe question is why the other overload wins.
14:57:13PMunchBut the one it should call is the one from the lists module for a DoublyLinkedList (or rather for SomeLinkedList)
14:57:43*NimBot joined #nim
14:57:46PMunchIt's not in the list, and if it was it should've just worked right?
14:58:01disruptekthat's what i mean; it's shadowing it.
14:58:20PMunchI don't think that's the issue..
14:58:35disruptekwhy not?
14:58:53PMunchBecause my items doesn't have anywhere near the same signature as the one for a list..
14:59:43PMunchI'd guess the issue is somewhere between all the generics I use in the Cache object and that the iterator for a DoublyLinkedList uses SomeLinkedList as its argument
15:00:37disrupteki can repro it using gram.
15:00:39disruptek!repo gram
15:00:40disbothttps://github.com/disruptek/gram -- 9gram: 11lightweight generic graph hack 15 2⭐ 0🍴 7& 4 more...
15:01:16disruptekoh, i don't export items here, nevermind.
15:01:59PMunchIn fact adding an iterator for DoublyLinkedList by just copying the `itemsListImpl` template from the lists module into cache.nim works fine.
15:02:53*zacharycarter joined #nim
15:03:42PMunchHmm, but moving that implementation into its own mini-module and doing "import lists except items" and "import listext" didn't work
15:03:56PMunchUntil I did "export listext.items
15:04:12YardanicoPMunch: seems to be related to static
15:04:36*zacharycarter quit (Client Quit)
15:04:38*cgfuh joined #nim
15:04:44YardanicoPMunch: small example to reproduce https://play.nim-lang.org/#ix=2noW
15:04:59disruptekworks fine if you lists.items(cache.order), right?
15:05:24Yardanicodisruptek: yes, but that's not the point
15:05:27Yardanicoit should work otherwise too :)
15:05:34disrupteki agree.
15:06:00PMunchAh, yes that does indeed work
15:06:27Yardanicoeven simpler example https://play.nim-lang.org/#ix=2noX
15:06:34Yardanicoso yeah, PMunch go ahead and submit a bug report :P
15:07:02PMunchYou're the one with the pretty, minimal examples :)
15:07:24Yardanicowell, it's not hard to learn how to select code and press backspace :P
15:07:33Yardanicoi wonder if it was already reported though
15:07:49Yardanicoseems like it wasn't
15:08:16*federico3_ joined #nim
15:08:47PMunchHaha :P
15:09:01PMunchI've got to walk the dog now anyways, he's getting impatient
15:09:15PMunchPushed disrupteks patch at least
15:09:17PMunchTTYL
15:09:18*PMunch quit (Quit: leaving)
15:16:07Yardanicosubmitted it for PMunch anyway :P https://github.com/nim-lang/Nim/issues/14459
15:16:09disbotCompiler can't find generic ``items`` when iterating over a field in a generic object ; snippet at 12https://play.nim-lang.org/#ix=2np4
15:17:24*federico3_ quit (Quit: WeeChat 2.8)
15:18:09*federico3_ joined #nim
15:18:42*Vladar quit (Quit: Leaving)
15:18:44*federico3_ quit (Client Quit)
15:23:35Zevvthat's a funny one
15:23:58disruptekit's a sigmatch issue, most likely.
15:24:15disruptekdamn module needs rewrite.
15:24:24Yardanicos/module/compiler
15:25:49Araqit has nothing to do with sigmatch and it's an old, known bug
15:26:06FromDiscord<Synth> Is there something like an fstring in Python in Nim?
15:26:21FromDiscord<Synth> So I can parse variables to a string?
15:26:47Zevv&
15:26:57Yardanico@Synth look into strformat module
15:26:58FromDiscord<Synth> Like:↵```py↵function(f"example {variable}")↵```
15:27:08FromDiscord<Synth> Oh alright, thank you
15:27:14Yardanico!eval import strformat; let a = 5; echo fmt"Hello, {a}!"
15:27:16NimBotHello, 5!
15:27:30Zevvuse &, not fmt! :)
15:27:38YardanicoZevv: because of escaping? :)
15:27:47FromDiscord<Synth> I'm confused ;-;
15:27:54Yardanico@Synth you should not forget that the expansion is done at compile-time though, so you can't have a format string based on runtime values
15:28:06YardanicoI mean stuff like let a = getUserInput(); fmt(a) wouldn't work
15:28:08FromDiscord<Synth> Ohh alright, thank you
15:28:14Yardanico@Synth https://nim-lang.org/docs/strformat.html#fmt-vsdot-amp
15:28:25FromDiscord<Synth> What's the different between fmt and &?
15:28:29Yardanicocheck the link
15:29:08ZevvI find that paragraph misleading, as it says `The fmt"{expr}" syntax is more aesthetically pleasing`
15:29:30FromDiscord<Synth> Ahh okay, thank you!
15:29:36YardanicoZevv: for some it is
15:29:38Yardanicofor some it's not :P
15:29:47YardanicoI actually find myself preferring & though
15:36:16*Trustable joined #nim
15:38:03*sschwarzer joined #nim
15:39:23FromDiscord<Rika> you can always do `fmt "{expr}"` tho, no?
15:39:32Yardanico@Rika I meant this:
15:39:53Yardanico!eval import strformat; let a = 5; let b = "it's {a}"; echo fmt(a)
15:39:54FromDiscord<Rika> i mean the differences are gone when you add as tring
15:39:57NimBotCompile failed: /usercode/in.nim(1, 58) Error: type mismatch: got <int>
15:39:57FromDiscord<Rika> *space
15:40:00FromDiscord<Rika> not string
15:40:05Yardanico!eval import strformat; let a = 5; let b = "it's {a}"; echo fmt(b)
15:40:07NimBotCompile failed: /usercode/in.nim(1, 59) Error: string formatting (fmt(), &) only works with string literals
15:40:11sschwarzerI think I can work on the tree iterator again and was looking at ticket https://github.com/nim-lang/Nim/issues/11929 . You had a link in one of the comments, https://gist.github.com/disruptek/52ebcc5b02aa22781500369a0f95b739#file-walker-nim , but the link target doesn't exist anymore.
15:40:12disbotxmltree: offer a way to iterate over a whole tree (similar to `items`/`mitems`, but recursive)
15:40:14Yardanicooh okay it has failsafe for this
15:40:33sschwarzeroops, should have gone in the private chat :)
15:40:58FromDiscord<Rika> !eval import strformat; let a = 5; echo fmt "it's {a}\nnot escaped i hope"
15:41:01NimBotit's 5↵not escaped i hope
15:53:03*ftsf quit (Ping timeout: 260 seconds)
15:57:19FromDiscord<Technisha Circuit> Does Nim have something like Python decorators?
15:58:27FromDiscord<InventorMatt> pragmas take the spot there for nim plus they have the added benefit of being ablt to chain multiple of them
15:58:58FromDiscord<Technisha Circuit> Oh okay
16:03:00FromDiscord<Rika> i mean you can chain python decorators
16:03:10FromDiscord<Rika> but there's gonna be a lot of height taken
16:07:22FromDiscord<willyboar> ~stream
16:07:23disbotstream: 11https://twitch.tv/disruptek (live video/audio) and mumble://uberalles.mumbl.io/ (live voice chat)
16:08:08FromDiscord<Clyybber> wow
16:08:20FromDiscord<Clyybber> just realized that NimNodes don't have ref semantics :D
16:08:37*elijahr joined #nim
16:08:40FromDiscord<Clyybber> wait
16:09:24FromDiscord<Clyybber> nevermind
16:10:08*elijahr quit (Client Quit)
16:20:30*tane joined #nim
16:22:59FromDiscord<Synth> Sorry, now I'm attempting to get the number of items generated by `product()` from itertools... anyone able to help me?
16:23:17bung_do I need handle system manually? I write a test that doest not quit
16:23:20FromDiscord<Synth> (edit) 'Sorry, now I'm attempting to get the number of items generated by `product()` from itertools... anyone able to help me? ... ' => 'Sorry, now I'm attempting to get the number of items generated by `product()` from itertools... anyone able to help me?Here's the source: https://narimiran.github.io/itertools/#product.i%2CopenArray%5BT%5D%2CopenArray%5BU%5D'
16:23:28Yardanico@Synth product is an iterator
16:23:28bung_system signal
16:23:41Yardanicoto store the results and stuff you need to use sequtils.toSeq
16:23:50Yardanicolike let data = toSeq(product(...))
16:23:58FromDiscord<Synth> Oh I see, thank you so much!
16:25:14*PMunch joined #nim
16:26:38sschwarzerSynth: How much items do you (roughly) expect? If you use `toSeq` you'll create the sequence in memory and depending on the size you might not want to do this, especially if you're interested in _only_ the size.
16:27:32sschwarzerSynth: If your sequence would become large and you just need the number of combinations, you can multiply the lengths of the input sequences for `product`.
16:32:29Yardanico@Synth to ping him on discord :)
16:32:50sschwarzerYardanico: thanks :)
16:34:25FromDiscord<Synth> A lot of items... haha
16:34:29FromDiscord<Synth> I mean, a lot
16:38:19sschwarzer@Synth: Then just multiply the input sizes.
16:40:04FromDiscord<Synth> I got it to work, thank you guys so much!
16:40:12FromDiscord<Synth> I'm pretty new to Nim and lately, I've been loving it
16:40:22sschwarzerSynth: You're welcome :)
16:40:27FromDiscord<Synth> I've tried Rust but I didn't like it...
16:40:31FromDiscord<Synth> It was too limiting haha
16:40:53sschwarzerSynth: I'm also relatively new. (Maybe not in months, but in the time I was able to spend on Nim stuff. ;-) )
16:41:42sschwarzerSynth: I also had a look at Rust, but since I (for now) mostly want a language for rather small command line scripts, Rust seemed me just too much overhead.
16:42:23sschwarzerI'm quite familiar with Python, but was now looking for something with static type checks and compiled code. :)
16:46:32*greenfork quit (Ping timeout: 265 seconds)
16:49:18*BohlAdmin joined #nim
16:55:54*r4vi quit (Ping timeout: 265 seconds)
16:56:22*BohlAdmin quit (Quit: Pull the pin and count to what?)
16:56:47alehander92ok
17:03:35alehander92what should i play with from my nim projects learn-compiler(the parallel/IC/other experiment) or nimvm-debugger
17:06:20*couven92 joined #nim
17:06:26alehander92learn
17:06:45*fredrikhr quit (Disconnected by services)
17:06:51*couven92 is now known as fredrikhr
17:08:44*couven92 joined #nim
17:11:04FromDiscord<zetashift> b-b-both?
17:26:26*r4vi joined #nim
17:27:26sschwarzeralehander: the debugger, debugging in Nim needs to improve :-)
17:27:57sschwarzeralthough debugging the compiled code hurts me most
17:29:14alehander92what do you think is the biggest lack with debugging the compiled code?
17:29:29alehander92my daily job is related to it (but its proprietary)
17:31:12sschwarzeralehander92: when I tried debugging my lazy tree iterator, the mental overhead of understanding the C/Nim datastructures was so big that I reverted to `echo`. I'm familiar with command line debuggers. (I use Python's `pdb` all the time.)
17:31:35alehander92hm
17:31:53alehander92have you tried e.g. gdb with sourcing nim-gdb.py from tools/
17:31:55sschwarzerI mean I understood and could navigate the data structures, but it took so much of my concentration that the debugger really was an advantage
17:32:11alehander92yeah, this makes perfect sense
17:32:17sschwarzeralehander: yes, gdb/nim-gdb.py was what I used.
17:32:38alehander92so what was mostly missing compared to e.g. C/C++-printers/tools
17:32:40sschwarzerI meant that the debugger was _not_ an advantage
17:32:54alehander92ah
17:33:23sschwarzeralehander: I wonder if you could improve the display of data structures so they look more what you'd think about on the "Nim level"
17:33:43sschwarzeralehander: Although I see that in some cases you really want the low-level stuff.
17:34:02alehander92yeah, but maybe a more concrete example would be good
17:34:11alehander92do you have somewhere the lazy tree lib
17:35:40sschwarzeralehander: my experiments so far: https://hg.sr.ht/~sschwarzer/vppdiff/browse/src/vppdiff/cleanxmi.nim . The iterator starts at line 39.
17:36:20sschwarzerBut I'm now working on a different approach, namely with the conventional iterator pattern (with `hasNext` and `next`).
17:37:53sschwarzeralehander: I'm not even sure whether what I'd like is possible. I think _if_ it's possible the debugger would need to know a lot about the original Nim code and semantics (I guess) to understand what the user expects.
17:38:03alehander92ah so its about inlining the iterator
17:38:36sschwarzeralehander: That too, but even with a different approach (without inlining) it was a problem.
17:39:44alehander92i get it
17:39:53*oprypin_ joined #nim
17:39:53alehander92i am sorry, i will look at it tomorrow mostly
17:40:03*oprypin quit (Ping timeout: 260 seconds)
17:40:04*FromGitter joined #nim
17:40:36alehander92but i guess just seeing mostly iterator state somehow would be useful and maybe a way to invoke iteration easily from the debugger?
17:41:12sschwarzeralehander: I found it difficult to check the XML tree structure "on the C level" instead of being able to say something "echo toSeq(items(xmlNode))"
17:41:25sschwarzeralehander: also that, yes
17:41:38alehander92yeah, so invoking the iterator would be useful
17:41:56sschwarzeralehander: Now I think what I want is a Nim repl inside the debugger. :-)
17:42:06alehander92hehe, or just a nim repl :P
17:42:16bung_xmlNode has a `$` proc doesnt it?
17:42:18alehander92yeah, they converge a bit
17:42:22sschwarzeralehander: a Nim repl would _also_ help :)
17:42:43alehander92yeah, btw bung_ is right: its not hard to make `$` easier to call in gdb
17:42:47sschwarzerbung_: yes, I don't remember right now if you can use it inside the debugger.
17:42:55alehander92dollar__ are there
17:43:13alehander92you need to loop and just map them using their typeinfo so a command can know which one to invoke
17:43:14sschwarzeralehander: as in `dollar__(myObject)`?
17:43:19alehander92one can add that to nim-gdb
17:43:25alehander92well like dollar__hash
17:43:40bung_idk now , never debuging in nim
17:43:45alehander92thats the thing, currently without this additional python command its annoying to filter for that
17:43:53sschwarzeralehander: essentially the "repl in the debugger" is what Python's debugger offers.
17:43:57alehander92i wrote somthing like that for my job once
17:44:48alehander92but toSeq(items()) should be also doable with just writing a simple myItems {.exportc.} which does it
17:44:50alehander92and invoking it
17:44:53sschwarzeralehander: Ideally I'd like to be able to execute statements as they could have been written in the Nim source file in the respective scope.
17:45:05alehander92i admit: a much more hardcoded thing, but for a workaround for now
17:45:16alehander92yeah this is a good goal
17:45:36alehander92in our project, we do something kinda similar (but just for some expressions, not statements)
17:45:52alehander92maybe one can try to just add limited nim support to gdb?
17:46:02alehander92i think they do have infrastructure for many languages
17:46:12alehander92but no idea if this applies to setting variables / access
17:46:14sschwarzerfor example, also `inc(counter)` and continue debugging to see what would happen with this extra increment. But as a first step, inspecting data "on the Nim level" would already be great (I think)
17:46:26alehander92yeah, this would be much harder
17:46:38alehander92this basically requires the repl+debugger combo
17:46:44alehander92maybe
17:47:52sschwarzeralehander: I was looking at some point at stuff I could contribute to Nim. And as much I'd like this better debugging support, I almost immediately thought this would be far too difficult for my level. :)
17:48:32sschwarzerI _still_ want to contribute to Nim, but it's really a problem to find the time.
17:48:45sschwarzerThe lazy iterator thing was months ago. :-/
17:49:28sschwarzeralehander: it's about this thread: https://forum.nim-lang.org/t/5697
17:50:06*waleee-cl quit (Quit: Connection closed for inactivity)
17:51:00sschwarzerUnfortunately, there was a critical bug in the code I thought was working and the code I had at this point was already so difficult to understand that I didn't try to fix it but restart with the iterator (design pattern) approach.
17:51:53sschwarzerThe code in itself was/is basic Nim, but keeping in your head what the current state during execution is was too difficult for me.
17:52:54sschwarzerThen I tried the debugger and the mental overhead of "translating" the C datastructures to Nim datastructures canceled out the insight I could have gotten from using the debugger.
17:53:06alehander92yeah, this makes sense
17:53:14bung_found there's https://github.com/barcharcraz/nim-libxml2/ might be helpful
17:53:30bung_a cpp wrapper
17:54:01alehander92<3 useful!
17:55:10alehander92sschwarzer debugging support isnt really "difficult" its mostly about motivation/patience to study the related apis/toolset/language repr
17:55:11sschwarzerbung: Does it allow to delete nodes from the tree while iterating over it? (That's what I tried.) That said, what I _ultimately_ want to achieve can probably also be done more "manually" on a greedily evaluated list of nodes, but maybe that's not really easier.
17:55:59alehander92otherwise yeah here might be a way to do it but i will think a bit tomorrow
17:56:58sschwarzerJust looking at `nim-libxml2` ... I'm not even sure how I'd use it from Nim. A README might have helped. ;)
17:57:55bung_I checked it support xpath that's easier for debuging
17:58:40bung_it's a wrapper if it fully wrapped , you just need read from http://www.xmlsoft.org
17:58:49sschwarzeralehander: yes, on principle you can understand almost everything if you have enough time to learn the prerequisites. :)
17:59:07sschwarzerbung: Right, XPath is nice.
17:59:21PrestigeHow should I be retrieving data from a PPcuchar? that's a ptr ptr cuchar
17:59:30alehander92that's true :) but there is not much *complexity* in many of the currently popular user requests for debug stuff
17:59:56YardanicoPrestige: isn't that an array of strings?
18:00:02disruptek!last clyybber
18:00:02disbotclyybber spoke in 12#nim 110 minutes ago
18:00:25FromDiscord<InventorMatt> could nimscript be used as a debugging mechanism? like you run your standard nim through nim and you could easily go through it line by line?
18:00:27PrestigeYardanico: in this case it's just a char array
18:00:38YardanicoPrestige: huh?
18:00:44Yardanicochar** ?
18:00:55PrestigeYeah
18:01:05Yardanicothat looks like an array of strings for me usually
18:01:07sschwarzerNow I remember what I missed was the ability to delete a node in-place, without having the parent at the same time. There's also a ticket on this: https://github.com/nim-lang/Nim/issues/11729
18:01:07disbotxmltree: Clear a node, not only its children
18:01:10Yardanicoit's basically a 2d character array
18:01:21Zevvor a pointer to a cstring, commonly passed to functions that allocate a string for you
18:01:23Prestigeusually is but it's just a way for xlib to return properties for windows
18:01:24sschwarzerBut I'm not sure if such an API would be a good fit for Nim.
18:01:37sschwarzerHey disruptek! :-)
18:01:47disruptekhey
18:01:47PrestigeUnsure how to reference the data
18:02:18bung_sschwarzer that's common, think of html parser
18:02:30PrestigeYardanico: https://tronche.com/gui/x/xlib/window-information/XGetWindowProperty.html for context (the last param)
18:02:49bung_many scraper need modify the html tree
18:03:29YardanicoPrestige: yes, see nitems_return
18:03:33Yardanicoprop_return is an array of strings
18:03:38bung_modify the tree data structure then serialize it to string
18:03:39Yardaniconitems_return gives you len of that array I think
18:04:01sschwarzerbung: right, Python's ElementTree has this ability. Yes, I think it'd be common.
18:04:28bung_have you try just set the node to nil?
18:04:51sschwarzerI'm just checking the ticket. It seems that Nim would need some identity of the node. Otherwise if you have two child nodes with the same data, Nim wouldn't know which one to delete.
18:05:39sschwarzerbung: Do you mean assigning `nil` to the parent where the child is?
18:05:45PrestigeYardanico: do I have to cast this? I thought I could just access the data like - val[][i] or something similar
18:05:58bung_yes assign parent to nil
18:06:00sschwarzerbung: There's a `delete` proc, but it requires the parent and the child index.
18:06:59YardanicoPrestige: try cast[UncheckedArray[cstring]](yourptr)
18:07:28sschwarzerSo by the time, I "arrive" at the child node during the iteration, I no longer have access to the parent. Of course, it can all be done "somehow", but it may not be trivial. I don't remember all details since this was months ago and I hardly did any Nim programming since then if at all.
18:08:52sschwarzerObject identity doesn't seem to be something that's usually used in Nim, if at all. Objects usually have value semantics (which I usually like!).
18:10:02*Guest37650 quit (Ping timeout: 256 seconds)
18:10:14bung_what's "Object identity" ?
18:10:21PrestigeLooks like I can cast[ptr UncheckedArray[ptr cuchar]](myPtr) and that works for some reason (I think)
18:10:32sschwarzerSo meanwhile we're talking about at least three inter-connected things. :) I guess the debugging improvements would be the most interesting from my point of view because they would help "universally", not only for this XML tree usecase.
18:11:52sschwarzerbung: It means that objects can be distinguished even if they have the same state. In Python this is usually done via the address (which is abstracted with help of the `id` function) of an object.
18:12:31YardanicoPrestige: ptr cuchar == cstring
18:12:43Yardanicoif it's not binary data ofc
18:12:46PrestigeYeah, I'm wanting the individual characters though
18:12:48Yardanicobecause cstrings are null terminated
18:12:48bung_oh that's repr proc
18:12:54Prestigeafaict
18:13:04bung_in nim you can just use `repr proc`
18:13:13Prestigeeach char is some data that I want to read, like a window position etc
18:13:54PrestigeI'm getting actual characters back instead of their numerical values though
18:15:17bung_and I checked the xmltree doc `XmlNode = ref XmlNodeObj` it's just reference.
18:15:40sschwarzerbung: yes, this gives me the address, but as I understand it doesn't allow me to remove the child from the parent if I don't have access to the latter.
18:15:43*dadada joined #nim
18:16:08*dadada is now known as Guest81893
18:19:03sschwarzerbung: My understanding was that deleting a child from a parent means that the child node would be removed from a `seq` of children that the parent node has. But I'm not 100 % sure. Also not sure if setting the child to `nil` would work (haven't seen it documented, and I'd only want to rely on documented behavior).
18:19:30bung_ok, try that cpp wrapper see if it can locate node through xpath , then that's would be easy
18:20:43PrestigeYardanico: would you be up to chatting about this? I feel like I'm just stuck on the nim concept of how to do this.
18:21:02YardanicoPrestige: i don't have enough experience either, I'm mostly just telling from some knowledge I have :P
18:21:12bung_well you can just think of the data structure , it's a tree store references, if node set to nil then that node is gone.
18:21:31Yardanicobtw crashed the compiler with my async stuff :D
18:21:32YardanicoError: unhandled exception: closureiters.nim(397, 9) `n.kind == nkStmtListExpr` [AssertionDefect]
18:21:34sschwarzerThat would also be the first time I use a wrapper that doesn't have a "safe" Nim API. But yes, I can try it. (Although honestly I'm also curious to get the iterator pattern to work. ;-)
18:21:50PrestigeDang.
18:22:48sschwarzerbung: But my understanding is I need to set the reference to `nil` _in the parent_? But maybe I'm just confused now. ;-/
18:23:49bung_set whatever node you'd like let it gone
18:23:56sschwarzerbung: Sorry, was still speaking about Nim `xmltree`. With the libxml wrapper, XMLPath can give the parent relatively easily I suppose.
18:24:36sschwarzerI haven't looked at the xmllib2 API yet.
18:25:04*zacharycarter joined #nim
18:25:04bung_check it maybe same data structure
18:25:39*Midnight25 joined #nim
18:25:43bung_once locate the node you got the reference ,set it to nil, or maybe that lib provide a simple api.
18:26:34*Midnight25 quit (Remote host closed the connection)
18:28:29PrestigeMaybe this will make more sense than me talking about it Yardanico: https://play.nim-lang.org/#ix=2nq5
18:28:57Prestigehttps://play.nim-lang.org/#ix=2nq6 rather <-
18:29:31sschwarzerbung: I guess the next thing would be to get the "lazy tree iterator with deletable nodes" working in pure Nim. It _could_ be that using the libxml2 wrapper would be easier, but I'm eager to experiment with the iterator approach. Also because I can imagine that it would be useful in other situations as long as Nim doesn't allow nested iterators.
18:31:18sschwarzerbung: To me it seems that I can provide a simple lazy iterator that would internally use conventional iterators (the design pattern). So the internal design pattern would be an implementation detail and the public API would be simple and straightforward.
18:32:28bung_that's programming design pattern and algorithm
18:32:59sschwarzerThe existence of nested iterators in Python has spoiled me so much that it'll probably take some effort to the nested iterators working. But let's see.
18:33:06sschwarzerbung: exactly
18:34:21sschwarzerbung: something like this, but surely easier to apply in Nim: https://en.wikipedia.org/wiki/Iterator_pattern
18:34:38*cgfuh quit (Quit: WeeChat 2.7.1)
18:35:05*cgfuh joined #nim
18:35:06sschwarzerbung: My plan is to have an `Iterator[N]` object that stores the state and `hasNextNode` and `nextNode` procs taking the iterator object as argument.
18:37:17bung_well , you can for value in iter :yield value
18:37:18sschwarzerI'm just not nearly as proficient in Nim as in Python, so thinking about how to do the Nim implemenation and of course actually implementing it just doesn't come as easily for me as for an experienced Nim developer.
18:37:55sschwarzerbung: Right, this will be the outer layer, so to speak.
18:38:33sschwarzeriterator treeIter[N](root: N): N =
18:38:33sschwarzer rootIterator = newIterator(N)
18:38:33sschwarzer while rootIterator.hasNextNode():
18:38:34sschwarzer yield rootIterator.nextNode()
18:38:57sschwarzerThis iterator would be the API for the user of the libary.
18:39:21sschwarzer(But it's not tested, so there may be bugs even in this simple code. :-D )
18:39:30*Guest81893 quit (Ping timeout: 260 seconds)
18:39:50bung_oh , that would store in diferent data structure.
18:40:05*cgfuh quit (Quit: WeeChat 2.7.1)
18:40:15*cgfuh joined #nim
18:40:20sschwarzerbung: The existence of the `Iterator` object(s) would be an implementation detail.
18:40:43sschwarzerThe user should only use `treeIter` (possibly changed to another name).
18:40:49sschwarzerThe user should only use `treeIter` (possibly changed to another name later).
18:41:00*dadada__ joined #nim
18:41:21bung_try and see
18:42:21*cgfuh quit (Client Quit)
18:43:18*cgfuh joined #nim
18:44:15sschwarzerbung: Yep :)
18:44:30sschwarzerThanks for your feedback everyone! :-)
18:45:01sschwarzerI'm looking forward to better debugging support. ;-D
18:46:06bung_np, good luck!
18:47:46*waleee-cl joined #nim
18:47:46*cgfuh quit (Client Quit)
18:48:05*cgfuh joined #nim
18:50:01*avatarfighter joined #nim
18:50:24*cgfuh quit (Client Quit)
19:01:48federico3we need a good flatbuffers wrapper
19:02:55FromDiscord<Recruit_main707> wrapper?
19:03:03FromDiscord<Recruit_main707> implementation rather
19:03:21FromDiscord<Recruit_main707> im too lazy to finish mine yet :P
19:03:25FromDiscord<Recruit_main707> but its almost done
19:10:36FromGitter<deech> In `gc:{a,o}rc` land how do I tell Nim to not call the destructor on a Nim object passed as a pointer to another language via FFI? Previously I would use `GC_unref` and `GC_ref`.
19:11:26FromDiscord<Recruit_main707> federico3: i can show you mine so far
19:11:40FromDiscord<Recruit_main707> there are only a few functions to be transpiled
19:15:11Yardanico@deech use GC_ref and GC_unref :)
19:15:22Yardanicoarc still has refcounting
19:15:48Yardanicosee https://github.com/Yardanico/nim-snippets/tree/master/clib
19:16:30FromGitter<deech> Ahah! Good stuff!
19:16:42Yardanico--debugger:native is optional of course
19:31:20leorize!repo flatbuffer
19:31:21disbothttps://github.com/Skrylar/skflatbuffers -- 9skflatbuffers: 11FlatBuffers implementation in pure Nim. 15 3⭐ 0🍴
19:31:30leorizefederico3: ^
19:32:58sschwarzerIf a proc returns a ref object, is `new(result)` implied or do I need to call it explicitly in the proc?
19:33:02federico3leorize: I have the bot in /ignore
19:33:12Yardanicosschwarzer: if you use object construction syntax - no need for that
19:33:24leorizefederico3: why though lol https://github.com/Skrylar/skflatbuffers
19:33:25Yardanicootherwise - yes, you need to have it before any "result.a = xxx" assignments
19:33:33Yardanicobut really just use object construction :)
19:34:06sschwarzerYardanico: You mean object construction syntax = `MyNewObject(x: myX)`?
19:34:10Yardanicosschwarzer: yes
19:34:19Yardanicootherwise you'll need to call new(result)
19:34:28sschwarzerYardanico: fine, yes, I'm using this :)
19:34:29Yardanicosince ref objects are nil by default
19:34:36Yardanicosschwarzer: ah then it's fine :)
19:35:00federico3leorize: I saw that repo.
19:36:17sschwarzerleorize: What was the Neovim command again to stop your Nim plugin (and implicitly restart it) without restarting Neovim? :)
19:37:15sschwarzer(background: an identifier is marked as an error (red background), but the code compiles and works fine)
19:37:15Yardanico@deech also updated that example to show how you can do simple error handling :P
19:37:21Yardanicomostly for myself
19:37:25federico3leorize: it looked quite unfinished and it's missing a license
19:37:37Yardanicoalso -fsanitize=address with clang helped me remember that in C values are not initalized by default
19:37:39leorizesschwarzer: call nim#suggest#ProjectStop()
19:38:05Yardanicoand valgrind too "Conditional jump or move depends on uninitialised value(s)"
19:39:27sschwarzerleorize: I found the function, but calling it didn't help. Hm, could it be related to the fact that the "error" identifier appears as argument to `toSeq`?
19:40:05sschwarzerWith "error identifier" I mean the identifier highlighted as error.
19:40:13leorizewell just do something afterwards and it should redraw the highlight :P
19:40:55sschwarzerleorize: I deleted the buffer with the file, called `ProjectStop` and implicitly reopened the file with ctrl-o
19:41:04*abm quit (Ping timeout: 246 seconds)
19:41:25leorizeuh... ProjectStop relies on a variable in the buffer
19:41:40leorizeso call that first then close the buffer
19:42:37sschwarzerleorize: tricky ... but it worked, thanks! :)
19:43:06leorizenp, though I would rather that we don't have to do this at all :P
19:43:23sschwarzerleorize: honestly, I was just thinking the same :-D
19:43:44sschwarzerYes, it's just a workaround, not a real solution
19:44:09sschwarzerIs it actually related to `toSeq` (or certain forms of templates)?
19:44:34Yardanicois it ok to (ab)use "sink" to get a "var" variable in the proc for free? :)
19:44:44Yardanicoso I don't have to do "var myvar = myvar"
19:47:12FromGitter<deech> Yardanico, thanks! Very helpfu.
19:51:44*opDispatch is now known as B4s1l3
19:51:46*B4s1l3 is now known as opDispatch
19:53:00*abm joined #nim
19:56:44sschwarzerleorize: I just looked at the tickets at https://github.com/alaviss/nim.nvim/issues (both open and closed) and there doesn't seem to be a ticket about this problem. Or did I overlook it?
19:57:39*lritter joined #nim
19:57:41leorizeyea, but don't report there, this is a nimsuggest bug :P
19:57:50leorizedo it at nim-lang/nimsuggest
19:58:05leorizemaybe I should make it easier to generate data for reproducing without nim.nvim
19:58:26sschwarzerleorize: oi
19:59:04leorize[m]Yardanico: wait what you can abuse `sink` like that?
19:59:25Yardanicoleorize[m]: of course?
19:59:38Yardanicosink moves the variable if it can prove there are no reads after that call
19:59:41Yardanicoand otherwise copies it
19:59:43Yardanicobut it's mutable
19:59:49Yardanicoalways mutable*
20:00:17sschwarzerleorize: Now I wonder what I should write in the nimsuggest issue. I have no idea where this problem comes from and how to convince them the problem comes from nimsuggest and not nim.nvim ;-)
20:00:51sschwarzerleorize: Can you tell by looking at the nimsuggest issues if there already seems to be a ticket on this problem?
20:01:15leorizeI don't think I remember reading one
20:01:24leorizebut seems like this impacts vscode users too
20:01:34sschwarzerIf you know it's a nimsuggest issue, you probably already know what nimsuggest does wrong (even if you may not know in detail what to change in nimsuggest)
20:01:47leorizeI have seen people talking about how their code is marked as error but was fine when compiled
20:01:55sschwarzerleorize: If there's already a ticket on this it doesn't make sense to enter another one :)
20:02:12sschwarzerleorize: yes, that's my situation, too.
20:02:17Yardanicoleorize[m]: yeah I had that too
20:02:29Yardanicoit's nimsuggest's fault as far as I know
20:02:33sschwarzer(at least what occurred today)
20:02:48*neceve quit (Ping timeout: 256 seconds)
20:03:12Yardanicotry nimsuggest --stdin --debug src/file.nim (when you're in project root dir)
20:03:19Yardanicoand then type "chk src/file.nim"
20:03:56YardanicoI get errors from tables.nim
20:04:13Yardanicohttps://gist.github.com/Yardanico/ad66b369ea940c08671b01bc0f0365bb
20:04:55leorizeYardanico: does nim check trips on that too?
20:05:07leorizeif it does just report it as a nim check bug
20:05:10Yardanicoleorize: no :)
20:05:11leorizeget things fixed faster
20:05:13Yardaniconim check reports noe rrors
20:05:22leorizeoh lol
20:05:24Yardanicoso it's nimsuggest-specific
20:05:42YardanicoOne way to do it (like the vscode nim extension does) - run nimsuggest for intellisense
20:05:46Yardanicobut nim check for checking for errors :D
20:06:03Yardanicoand it actually works well (nim check runs on save)
20:06:15FromGitter<awr1> https://github.com/microsoft/winget-pkgs
20:06:20Yardanicoyeah saw that :P
20:06:20FromGitter<awr1> might be a good idea to get nim added as a package
20:06:23leorizewell that's just walking around the issue
20:06:31Yardanicoleorize: true
20:07:11leorizeI really need to work on nimsuggest again sometime
20:07:22leorizeor do you wanna try to see if you can fix all this? :)
20:07:29Yardanicolol
20:07:33YardanicoI don't think so right now :P
20:08:51sschwarzerYardanico: this gives me some quite unexpected output: https://pastebin.com/raw/4BC8R5z6
20:09:07*PMunch quit (Quit: leaving)
20:09:27sschwarzerIn my case the file is a tests file that compiles and runs as expected.
20:09:32leorizemy guess is that nimsuggest doesn't initialize the compiler correctly
20:09:44leorizeprobably fixable with some patch work
20:10:16leorizenow that we also have the --backend thingy we can also make nimsuggest backend-aware too
20:18:21*liblq-dev quit (Quit: WeeChat 2.8)
20:18:26*Senketsu joined #nim
20:23:27bung_any lib for cli header info ?
20:23:30*abm quit (Quit: Leaving)
20:26:36*tdc quit (Ping timeout: 256 seconds)
20:28:05*Senketsu quit (Ping timeout: 265 seconds)
20:29:46bung_@leorize am interested , what's the todos
20:32:34FromDiscord<mratsim> Raytracing, now with animation: https://github.com/mratsim/trace-of-radiance/pull/4
20:32:36disbotAnimation
20:34:31leorizesschwarzer: can you share the faulty file?
20:35:06leorizeactually if you can open a nimsuggest bug :P
20:35:22zacharycartermratsim: awesome!
20:37:34sschwarzerleorize: I can give you the file that showed the error, but after having restarting the plugin, I don't see the error anymore, as mentioned. Does it still help to have the file(s)? (It's a test file and the file it tests.)
20:38:32leorizeif you can share a file that trips `nimsuggest chk`, that'd be great :)
20:38:40Yardanicoleorize: ok, wait a bit
20:38:49sschwarzerleorize: And I'm not completely sure whether I have exactly the file I had. I continued working on the file, but I _think_ the "error problem" was with the version I last committed.
20:39:00leorizeif we can craft a minimal reproducible sample from that it'd be the first step to figuring out why things fail
20:39:18leorizewell the `chk` bug seems to be reproducible
20:39:30leorizeso we cna just target that first
20:39:32leorizecan*
20:39:39sschwarzerleorize: You mean as with the pastebin content https://pastebin.com/raw/4BC8R5z6 ?
20:40:24YardanicoWould there be any issues with an object variant with a lot of branches?
20:40:25leorizeyes :)
20:40:34YardanicoLike at least 100
20:40:40leorizeidk :p
20:40:44Yardanicorip
20:40:54leorizenimsuggest uses the compiler, and if the compiler doesn't trip, it shouldn't trip as well
20:41:21sschwarzerleorize: ok, I'll try to create/restore consistent files that compile but show the problem and put them on pastebin.
20:44:24bung_I create on nimsuggest issue https://github.com/nim-lang/Nim/issues/14461
20:44:27disbotnimsuggest reporting value out of range: -1 notin 0 .. 9223372036854775807 [RangeDefect] ; snippet at 12https://play.nim-lang.org/#ix=2nrm
20:44:56bung_not sure how to correct reportting nimsuggest issue.
20:45:08leorizebung_: once they created a reproducible test case you can try to work on it
20:45:57bung_you mean I just take care of bug reported is fine?
20:46:12leorizewell reporting bugs with nimsuggest is hard
20:46:31leorizesince you can't really isolate things down to a reproducible sample
20:46:50bung_that's true.
20:47:52bung_I guess I need fork nimsuggest source then commented it first, if I work on it.
20:48:25sschwarzerleorize: https://pastebin.com/htZ3M7T7 and https://pastebin.com/zLwNpnDj . Output from nimsuggest: https://pastebin.com/raw/4BC8R5z6
20:48:32bung_it's not kind of lib that well documented.
20:48:43Yardanicobung_: nimsuggest code is in the compiler :)
20:49:01Yardanicowell, it's separate but you can find stuff like "when defined(nimsuggest): code specific for nimsuggest" in the compiler
20:49:26leorizeif you're lost you can consult me for a map of how nimsuggest work
20:49:43sschwarzerleorize: maybe you want to try the files yourself so you can reproduce the problem if there's a misunderstanding or something.
20:49:51bung_ok , I can try step by step , may take long.
20:51:58*Jesin quit (Quit: Leaving)
20:52:25planetis[m]Are there any plans for Nim to have let variables that alias instead of copy a resource when its safe?
20:52:46leorizeyes
20:54:08planetis[m]If you use lent T and assign it, it copies right?
20:54:48leorizesschwarzer: confirmed that it's reproducible
20:54:54leorizecan you open an issue?
20:55:27*avatarfighter quit (Ping timeout: 260 seconds)
20:55:47sschwarzerI guess you'd be more qualified to describe the problem, but I can do it if you want. :)
20:56:07leorizeplease :)
20:56:16*Trustable quit (Remote host closed the connection)
20:56:29sschwarzerleorize: ok :-)
20:56:30bung_oh I see the nimsuggest tests, test against file source
20:56:31FromDiscord<mratsim> @planetis no it sinks
20:56:44*avatarfighter joined #nim
20:57:02FromDiscord<mratsim> ah sorry misread, yes it copies but if you use in another proc it does not
20:57:19FromDiscord<mratsim> otherwise you templates instead of assignments
20:58:00FromDiscord<mratsim> there was a discussion about creating an alias shorthand that voids having to do "template foo: untyped = myAliasedFoo"
20:58:28Yardanicoleorize: actually seems like it'll be 161 branches :P
20:58:33Yardanicoi hope nim would work for that XD
20:59:46planetis[m]so no way i can get rid of those templates, so be it.
21:01:38planetis[m]mratsim: awesome work on your raytracer project btw
21:01:54*opDispatch quit (Ping timeout: 240 seconds)
21:02:06*opDispatch joined #nim
21:03:00*Jesin joined #nim
21:05:07*Senny joined #nim
21:09:03*opal quit (Ping timeout: 240 seconds)
21:11:58sschwarzerleorize: submitted as https://github.com/nim-lang/nimsuggest/issues/115
21:11:58disbotNimsuggest reports lots of errors for a file that compiles fine
21:12:17leorizebung_: ^ you can try to tackle that
21:13:50FromDiscord<mratsim> @planetis, thanks :), I'm happy to get out of the color conversion and video rabbit hole 😛
21:16:27*Senny quit (Ping timeout: 260 seconds)
21:17:09sschwarzerplanetis, mratsim: completely agreed. I'm also impressed by mratsim again and again :)
21:20:50*opal joined #nim
21:31:42FromDiscord<j$> when should a nimscript task print the description?
21:38:34*dadada__ quit (Ping timeout: 240 seconds)
21:45:41*dadada joined #nim
21:46:06*dadada is now known as Guest61634
21:48:53FromGitter<kaushalmodi> j$: Not sure what you mean.. you mean how to print the descriptions of all nimscript tasks?
21:49:15FromDiscord<j$> yeah
21:49:21FromGitter<kaushalmodi> type `nim help`
21:57:10bung_leorize any suggestion? seems the error info also cant locate where the problem is..
21:58:06*tane quit (Quit: Leaving)
21:58:32leorizebung_: it does located the location, its (col5, col6)
21:59:12leorizethe first thing you should do is see how the compiler is setup by nimsuggest compared to nim, nimpretty, nimfind
21:59:28leorizemaybe some steps in initializing the vm was skipped
22:01:16bung_hmm any article I could read first? afaik it build a graph data for project
22:02:39shashlickis it possible to get the gnu triplet - e.g. x86_64-linux-gnu from Nim during compile time?
22:03:13bung_https://pastebin.com/cxL2NHcw see information give me doesnt help
22:03:39bung_I even add `doAssert maxSlots > -1` before the line vm.nim 2271
22:07:11shashlicki see there's hostOS for os and hostCPU for arch but no way to know the abi
22:09:28*Guest61634 quit (Ping timeout: 246 seconds)
22:14:25leorizeshashlick: the triplet is not a nim thing unfortunately
22:14:32leorizeyou can query gcc for this
22:15:34*dadada__ joined #nim
22:17:36*sschwarzer quit (Quit: leaving)
22:29:37*dadada__ quit (Ping timeout: 264 seconds)
22:30:37*dadada joined #nim
22:31:02*dadada is now known as Guest90170
22:54:16*Guest90170 quit (Ping timeout: 246 seconds)
23:00:38*dadada__ joined #nim
23:01:12*avatarfighter quit (Ping timeout: 260 seconds)
23:09:23*couven92 quit (Read error: Connection reset by peer)
23:09:31*avatarfighter joined #nim
23:19:58*solitudesf quit (Ping timeout: 260 seconds)
23:24:19*dadada__ quit (Ping timeout: 260 seconds)
23:30:36*dadada joined #nim
23:31:03*dadada is now known as Guest73984
23:49:30skrylar[m]hoi
23:54:46*Guest73984 quit (Ping timeout: 265 seconds)