<< 07-11-2022 >>

00:01:31FromDiscord<voidwalker> `info_hash: urlencoded 20-byte SHA1 hash of the value of the info key from the Metainfo file. Note that the value will be a bencoded dictionary, given the definition of the info key above.`
00:02:53FromDiscord<voidwalker> how do I solve this ? If I pass %ab%cd%.. to URI queries, it converts '%' to '%25'
00:06:41FromDiscord<voidwalker> also btw, why isn't there even a trace of torrent library for nim ?
00:14:17FromDiscord<voidwalker> I guess I was wrong, there is something: https://github.com/aeaea-project/rentor
00:28:36FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=4faB
00:38:03*derpydoo joined #nim
00:50:43FromDiscord<demotomohiro> In reply to @ynfle "I'm trying to compile": Maybe backend C compiler targets linux is not used?
00:52:34*krux02 quit (Remote host closed the connection)
01:24:10*tanami quit (Ping timeout: 252 seconds)
01:30:53*jmdaemon joined #nim
01:50:22*nyeaa49284 quit (Ping timeout: 272 seconds)
01:54:19*Jjp137 quit (Ping timeout: 248 seconds)
01:54:38*Jjp137 joined #nim
02:12:53*tanami joined #nim
02:29:21*nyeaa49284 joined #nim
02:37:19*rockcavera joined #nim
02:37:19*rockcavera quit (Changing host)
02:37:19*rockcavera joined #nim
04:07:31*derpydoo quit (Ping timeout: 252 seconds)
04:12:12*arkurious quit (Quit: Leaving)
04:21:11FromDiscord<ynfle> In reply to @demotomohiro "Maybe backend C compiler": How do I fix that?
04:31:56FromDiscord<ynfle> Or what is the problem?
05:01:27*derpydoo joined #nim
05:05:58*rockcavera quit (Remote host closed the connection)
05:06:24*rockcavera joined #nim
05:06:24*rockcavera quit (Changing host)
05:06:24*rockcavera joined #nim
05:32:42FromDiscord<demotomohiro> In reply to @ynfle "How do I fix": run nim cmd with `--listcmd` option. That shows how Nim call backend C compiler.
05:33:11FromDiscord<demotomohiro> So you can check if Nim call the right backend C compiler.
05:35:15FromDiscord<ElementalX> Hi, this might be a dumb question to ask, but can something like this be done in Nim? https://blog.finxter.com/daily-python-puzzle-how-to-modify-sequence-while-iterating/ I.e., adding an element to a mutable sequence while iterating also is there any module or function which helps in printing the size of each element in case of the array has 5 strings and each has 4 characters each! Thank you!
05:35:39FromDiscord<Elegantbeef> It can be done just not with Nim's built in iterator
05:36:08FromDiscord<ElementalX> would be great if you could let me know more about it
05:38:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fbi
05:41:33termerwhen working with asynchttpserver and ORC GC, is it common to see huge amounts of memory allocation that never goes away?
05:41:45termerIt doesn't always continue to grow, so I don't know if it can be considered a memory leak
05:41:51termerbut I've noticed this with seemingly all async IO
05:42:26termeralthough it seems that sometimes it does grow more
05:42:55FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fbj
05:43:09FromDiscord<Elegantbeef> I dont think Nim's allocatr returns to the OS iirc
05:43:18FromDiscord<Elegantbeef> Iterate over each element and count the length
05:44:12FromDiscord<ElementalX> In reply to @Elegantbeef "Iterate over each element": some help would be appreciated
05:44:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fbk
05:45:07FromDiscord<ElementalX> thank you very much!
05:45:14FromDiscord<Elegantbeef> `inc result, x.len` rather or `result += x.len`
05:45:40FromDiscord<ElementalX> thank you!
05:47:02FromDiscord<Elegantbeef> I guess that should be `T: seq or string or array`
05:47:17FromDiscord<Elegantbeef> I'll just say "I was hoping you'd learn"
05:57:22*dtomato4 quit (Ping timeout: 272 seconds)
05:58:21*dtomato4 joined #nim
05:59:09FromDiscord<ynfle> In reply to @demotomohiro "run nim cmd with": What is the correct backend c compiler for this?
06:14:06FromDiscord<demotomohiro> I'm sorry but I don't know how to get gcc or clang that runs on your OS and compile to Linux.
06:14:58FromDiscord<Elegantbeef> Just use zig-cc 😄
06:19:38NimEventerNew thread by koistinen: Would Futo be good for Nim, see https://forum.nim-lang.org/t/9583
06:25:26FromDiscord<ynfle> In reply to @demotomohiro "I'm sorry but I": I'm on a macos m1
06:25:44FromDiscord<ShalokShalom> Yep, Zig CC
06:25:47*ltriant quit (Ping timeout: 248 seconds)
06:25:49FromDiscord<ShalokShalom> That cross compiles
06:26:00FromDiscord<ynfle> How do I get that setup?
06:26:15FromDiscord<ShalokShalom> You can also try to use Cosmopolitan
06:26:33FromDiscord<ShalokShalom> I think its probably really on time, to write a guide for that.
06:27:30FromDiscord<ShalokShalom> @ynfle https://zig.news/kristoff/compile-a-c-c-project-with-zig-368j
06:27:59FromDiscord<ShalokShalom> You just compile the Nim code to C or C++ and then do this
06:28:07FromDiscord<Elegantbeef> https://github.com/enthus1ast/zigcc
06:29:47termerwhy does zig cc matter over gcc
06:29:57FromDiscord<Elegantbeef> It has a cross platform linker
06:30:00termerand is it actually its own compiler or does it leverage a different compiler under the hood
06:30:05FromDiscord<Elegantbeef> It's basically Clang + linker
06:30:16termercool
06:38:38FromDiscord<albassort> how would I write something that sits inbetween the os and an application's text box's recording what you type?
06:38:56FromDiscord<albassort> my original idea was a kernel module but thats kinda hard
06:39:19FromDiscord<ChocolettePalette> X server↵(@albassort)
06:39:36FromDiscord<albassort> i need to interact with xserver
06:39:41FromDiscord<albassort> hmm
06:52:18FromDiscord<albassort> lets hope i dont need to wrap c
06:54:10FromDiscord<Rika> You most likely will
06:56:30FromDiscord<albassort> im either going to do bash shenanigans or https://github.com/luked99/libevdev.nim
06:56:55FromDiscord<ynfle> How can I get zig c to statically link against glibc?
07:13:16termerhave any of you tried using httpbeast with the ORC GC?
07:13:40termerWhenver I try it, I get illegal storage access errors when firing requests quickly and concurrently
07:13:53termerno such issues with refc
07:15:26FromDiscord<Elegantbeef> Is the error inside Orc's procedures?
07:16:38FromDiscord<Elegantbeef> If so it's likely that it uses behaviour that doesnt work well with Orc and it needs to be changed a bit
07:19:31FromDiscord<albassort> welp
07:20:13FromDiscord<albassort> time to figure out how scancodes work because i dont wanna wrap the standard libraryr
07:20:15FromDiscord<albassort> (edit) "libraryr" => "library"
07:20:33FromDiscord<Phil> In reply to @termer "have any of you": Only indirectly, my prologue project uses a fork of httpbeast
07:20:43FromDiscord<Phil> Since prologue uses said fork
07:22:51FromDiscord<Elegantbeef> I'd wager httpx works better with orc
07:23:07FromDiscord<albassort> historically I've had problems with http and orc
07:23:13FromDiscord<albassort> but i had some cursed code
07:23:22FromDiscord<albassort> no problems nowadays
07:23:39*PMunch joined #nim
07:23:49FromDiscord<Elegantbeef> Most issues from orc are caused by not understanding it's semantics as they tend to jumpout and bite you
07:26:27FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4fbO
07:35:05FromDiscord<albassort> ok turns out scancodes are pretty uh... not ufn
07:35:07FromDiscord<albassort> (edit) "ufn" => "fun"
07:36:16FromDiscord<Rika> :baqua:
07:36:59FromDiscord<Elegantbeef> `XStringToKeySym` `XStringToKeyCode` 😄
07:37:09FromDiscord<albassort> YO DO WE HAVE THAT
07:37:17FromDiscord<Elegantbeef> Of course in xlib
07:37:24FromDiscord<albassort> thank god
07:38:12FromDiscord<Elegantbeef> I dont know how one uses it outside of a WM context, but i know it exists
07:38:37FromDiscord<albassort> now all i need to do is figure out how when someone clicks on a message box
07:39:10FromDiscord<ElementalX> Hi am trying to create and empty array of size 10 : `var a: array = [10, int]`↵and then trying to iterate over numbers from 0..100 and only add those numbers which are divisible by 10 but as soon I try to iterate `for i in 0..100` it throws error, am doing some basic mistake help will be appreciated
07:39:31FromDiscord<Elegantbeef> `var a: array[10, int]`
07:39:54FromDiscord<Elegantbeef> `var a: array = [10, int]` certainly doesnt compile
07:40:16FromDiscord<albassort> In reply to @Elegantbeef "Of course in xlib": this isn't in stdlib...
07:40:26FromDiscord<Elegantbeef> Of course not
07:40:33FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fbP
07:40:54FromDiscord<Elegantbeef> I dont know what you point is elemental the code you provided is invalid
07:41:20FromDiscord<albassort> In reply to @Elegantbeef "Of course not": c bindings?
07:41:35FromDiscord<Elegantbeef> Of course
07:42:17FromDiscord<ElementalX> so its like : am trying these basic exercises which says create an empty array which can hold 10 integers and then fill that array with numbers 10,20,30,40 till 100
07:42:34FromDiscord<Elegantbeef> What does the compiler say?
07:42:59FromDiscord<ElementalX> Error: unhandled exception: index 11 not in 0 .. 9 [IndexDefect]
07:43:24FromDiscord<ElementalX> not sure what other way I could traverse from 0 to 100 and add it to the empty array
07:43:25FromDiscord<ElementalX> 😅
07:43:36FromDiscord<ElementalX> https://narimiran.github.io/nim-basics/#_exercises_3
07:43:37FromDiscord<Elegantbeef> `countUp` exists
07:43:48FromDiscord<ElementalX> yeah tried that too
07:44:00FromDiscord<Elegantbeef> What do you have now?
07:44:28FromDiscord<ElementalX> still the same error I tried `for i in countUp(0,100,10)` the same IndexDefect comes up
07:45:32FromDiscord<Elegantbeef> Well `0` and `100` are inclusive so that's not where the issue is
07:45:41*tiorock joined #nim
07:45:41*tiorock quit (Changing host)
07:45:41*tiorock joined #nim
07:45:41*rockcavera is now known as Guest726
07:45:41*tiorock is now known as rockcavera
07:45:47FromDiscord<Elegantbeef> It helps if you go to the right line
07:47:43FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fbQ
07:48:24FromDiscord<Elegantbeef> The array can only hold 10 elements and you're attempting to index \> 9
07:48:28FromDiscord<Elegantbeef> That's what an index defect is
07:48:33FromDiscord<Elegantbeef> `a[10] = 10` is invalid
07:48:40*Guest726 quit (Ping timeout: 260 seconds)
07:49:52FromDiscord<ElementalX> so where shall I fix it I mean at code
07:50:22FromDiscord<Elegantbeef> I can spoonfeed the answer then you learn nothing
07:50:48FromDiscord<ElementalX> sure lemme try once again I will get back to you
07:51:07FromDiscord<ElementalX> appreciate the time
07:57:12FromDiscord<ynfle> How can I find why my binary is trying to load a .so?
07:57:43FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=4fbS
08:05:05PMunchKind of hard to tell I think
08:05:27PMunchAre you doing any kind of HTTP work?
08:05:45FromDiscord<ynfle> Not me, but perhaps any of the dependencies
08:06:07FromDiscord<ynfle> Shouldn't they not be allowed to unless I compile with -d:ssl?
08:06:12FromDiscord<ynfle> https that is
08:06:29FromDiscord<ynfle> Which std lib procs use it?
08:06:48PMunchWell it depends if the library author uses a `when defined(ssl)` switch or if they just assume it's there
08:08:07FromDiscord<ynfle> Is there a way to undefine something?
08:09:23FromDiscord<ringabout> `--undef:ssl`
08:10:23FromDiscord<ynfle> No way...
08:11:37PMunchI'm pretty sure thats only for disabling things enabled by global configuration files
08:12:29PMunchBy the way @ynfle you can grep the Nim sources to get an idea about what uses ssl
08:12:32FromDiscord<ynfle> Does status bearssl load it? How would I checkout?
08:13:04FromDiscord<Elegantbeef> bearssl is statically linked there
08:13:48FromDiscord<ynfle> But if bearssl loads it would that make a difference?
08:14:00PMunchhttp://ix.io/4fbX/
08:14:52PMunchYou can probably run through execution in gdb as well
08:14:59FromDiscord<Elegantbeef> Bearssl doesnt use any dynamically linked libraries
08:16:21FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fbY
08:16:32FromDiscord<Elegantbeef> do not index with a value above the length of the array
08:16:41FromDiscord<Elegantbeef> the highest valid index is `9`
08:16:54FromDiscord<Elegantbeef> `for i in 0..100: a[i] = ..` will index with `10..100`
08:16:59FromDiscord<Elegantbeef> Those are all invalid
08:19:20FromDiscord<ElementalX> sure
08:19:32FromDiscord<ElementalX> thanks
08:22:36FromDiscord<ynfle> In reply to @Elegantbeef "Bearssl doesnt use any": I use awslambda which uses httpclient, but that only uses `http`
08:55:15*anddam joined #nim
08:55:22anddam /autojoin apply
08:55:27*anddam oopses
08:55:48anddamso leading spaces *do matter*
08:56:03anddamthat's proof
08:57:46FromDiscord<Rika> On your client
09:03:56madprops /ping
09:20:00FromDiscord<Rika> Pong!
09:27:31*ltriant joined #nim
09:30:45*derpydoo quit (Ping timeout: 260 seconds)
09:34:38FromDiscord<albassort> So far I've tried to directly read from hardware devices but I appear to be reading from some form of clock and not actually scan lines
09:35:01FromDiscord<albassort> It's completely trolled me because I was typing a b c every second and then it lined up and I thought it worked
09:35:16FromDiscord<albassort> But really it was just iterating over ASCII
09:37:01*neceve_ is now known as neceve
10:36:56*ormiret quit (Ping timeout: 246 seconds)
10:37:43*LuxuryMode quit (Read error: Connection reset by peer)
10:38:26*ormiret joined #nim
10:38:50*LuxuryMode joined #nim
10:52:06FromDiscord<luteva> is there a lib/helper that has procs for introspection? So that i can easily get the properties/fields of a type, the type of the parameters of a proc etc.? This would be much easier for many people than using macros and handling the hierarchy of the nodes imo.
11:05:07PMunchYou mean like macros.getImpl?
11:05:32PMunchI agree that someone could wrap those in a nicer API for easy introspection though
11:05:55FromDiscord<luteva> ... maybe, don't know.... xet 😄
11:06:03FromDiscord<luteva> (edit) "xet" => "yet"
11:14:16PMunch@Elegantbeef, did you look more into the semcheck issue for static fields in objects?
11:14:25PMunchI was considering to create a GitHub issue for it
11:29:07FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fcG
11:29:35Zevvhehe. I PR a one-liner and get a mail saying "Thanks for your hard work on this PR!"
11:31:53FromDiscord<dlesnoff> My first Nim commit was a sed command, that converted procs into funcs 😅 I can relate ^^
11:32:18FromDiscord<dlesnoff> (edit) "My first Nim commit was ... a" added "the result of"
11:32:37FromDiscord<dlesnoff> In reply to @Zevv "hehe. I PR a": Was this an automatic email ?
11:34:00PMunch@dlesnoff, how did you figure out what could be converted to a func by using sed?
11:35:02FromDiscord<dlesnoff> In our file, accidentally all the procs (maybe at a few exceptions) did not use sideEffects.
11:35:27FromDiscord<dlesnoff> (edit) "our" => "the Bigint project"
11:35:38FromDiscord<planetis> did you test with strictEffects? Because now its the default and it will break stuff
11:35:40FromDiscord<dlesnoff> (edit) "sideEffects." => "side effects."
11:36:46FromDiscord<dlesnoff> I don't understand. func is basically a wrapper of the pragma {.strictEffects.}. What has gone default?
11:37:32FromDiscord<planetis> the stricteffects it breaks for example status libs where they used func quite liberaly
11:38:17*vicecea quit (Remote host closed the connection)
11:39:27FromDiscord<planetis> well the fix is simple actually you just need to make it a var
11:40:02FromDiscord<planetis> for ref objects that are mutated
11:40:29FromDiscord<dlesnoff> Well I don't use ref objects that is why
11:40:43FromDiscord<dlesnoff> https://github.com/nim-lang/bigints/commit/bc3b2fa8ac77a5b6201824e06047ca4c234ef804
11:40:52FromDiscord<dlesnoff> I made that commit a long time ago
11:46:37FromDiscord<ringabout> Well, `stricteffects` become default on the devel branch but `strictfuncs` doesn't.
11:46:52FromDiscord<ringabout> (edit) "become" => "becomes the"
11:47:48FromDiscord<ringabout> `bigints` should be tested against `experimental:strictfuncs`.
11:49:12FromDiscord<ringabout> Oh, it does test with `strictfuncs` https://github.com/nim-lang/bigints/blob/a63df24b60e91e0d55bf7bd197c573b57ca852ef/bigints.nimble#L20
11:51:48FromDiscord<ringabout> In reply to @planetis "the stricteffects it breaks": I used some status libs with the devel branch. There are lots of problems caused by `stricteffects`. I stopped trying.
12:20:32*xet7 joined #nim
12:22:39*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
12:23:25*dtomato4 joined #nim
12:28:41*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
12:33:00*dtomato4 joined #nim
12:34:19*jmdaemon quit (Ping timeout: 248 seconds)
12:46:43*vsantana joined #nim
12:47:03FromDiscord<Tanguy> In reply to @flywind "I used some status": Do you know if https://github.com/nim-lang/RFCs/issues/435 be done for V2? Seems to me that strictEffect broke a lot of code (at least for people actually using gcsafe)
12:49:37FromDiscord<Tanguy> I'd rather wait for the compiler to be correct than add tons of temporary workarounds
12:50:47FromDiscord<ringabout> I don't the solution of that rfc. `legacy:laxeffects` should be useful for transition periods. There seems to be some other bugs for `stricteffects` which cannot be solved with `laxeffects` should be fixed indeed
12:50:57FromDiscord<ringabout> (edit) "I don't ... the" added "know"
12:51:26FromDiscord<ringabout> (edit) "There seems to be some" => "The"
12:54:42*dtomato4 quit (Quit: The Lounge - https://thelounge.chat)
12:55:04*dtomato4 joined #nim
13:13:13FromDiscord<ElementalX> In reply to @Jiezron "There are actually two": Thank you, that helps!
13:18:26FromDiscord<dlesnoff> In reply to @ElementalX "Thank you, that helps!": Don't hesitate to share your code once done (and ping me again).
13:21:40FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fd4
13:26:06FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fd6
13:31:03*derpydoo joined #nim
13:31:40FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fd8
13:32:54FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fd9
13:32:59FromDiscord<dlesnoff> (edit) "https://play.nim-lang.org/#ix=4fd8" => "https://play.nim-lang.org/#ix=4fda"
13:33:30FromDiscord<ElementalX> appreciate your help!
13:36:34FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4fdb
13:37:45FromDiscord<vindaar> (or well, in this case you can also do `echo collect(for i in 0 ..< 10: 10i)` to be more in line with the python case)
13:38:53FromDiscord<dlesnoff> I did not follow up on my python code sorry
13:41:42FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fdc
13:42:06*arkanoid joined #nim
13:43:43FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fde
13:45:50arkanoidmy projects have classic structure: src/ for project, and tests/test_*.nim for tests. I have two problems with this: vscode doesn't work on test files but only on project files, and when I run "nimble tests" it doesn't give me an aggregate view of the different test_*.nim files, but just runs each test_*.nim file separately and stdout is a mix of stuff that doesn't really feel like a test report
13:46:39arkanoiddo you know how can I improve this? I was thinking abount merging all test_*.nim files into test_all.nim and `include` all tests into that one. But this is smelly code, in my opinion
13:48:15FromDiscord<vindaar> keep the distinction in mind that this variant (while I use it a lot out of habit), actually loops twice over 10 elements. The `collect` one is a single loop (but has the downside of currently starting from a seq without explicit size, thus may lead to multiple reallocations, depending on use case)↵(@dlesnoff)
13:49:12FromDiscord<dlesnoff> In reply to @arkanoid "do you know how": Maybe you can make a new nimble task instead, that parse stdout, collect each timing/test results and outputs them nicely in a table or so.
13:49:38FromDiscord<vindaar> you don't need to use `include`. A simple `import` is fine. All top level code will still run↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>)
13:50:47FromDiscord<dlesnoff> In reply to @vindaar "keep the distinction in": But this uses std/sugar, which makes compile time and running time much slower (at least for the few small programs I tested this on).
13:51:51FromDiscord<dlesnoff> (edit) "In reply to @vindaar "keep the distinction in": ... But`collect`" added "Indeed!" | "this" => "`collect`"
13:51:58*vsantana quit (Ping timeout: 260 seconds)
13:52:37FromDiscord<vindaar> run time should only depend on what I just mentioned. Whether two loops with preallocated memory is faster vs one loop with reallocations will be use case dependent. `std/sugar` shouldn't really be that expensive to import though
13:56:52FromDiscord<pietroppeter> for the collect version you can use `collect(newSeqOfCap(10)):` to make sure memory is allocated correctly during sequence initialization. runtime performance wise I think it should be the same as the array (you will not get compile checks on indices in later usages).
13:57:21FromDiscord<pietroppeter> (and you cannot put it anymore in a single line)
13:57:35FromDiscord<dlesnoff> I am testing both versions on my machine
14:00:54FromDiscord<huantian> In reply to @arkanoid "do you know how": You might also want to think about using a different testing framework like balls which will give you a nice output
14:01:42arkanoidvindaar: thanks, I'm trying the single test_project.nim with all the imports
14:02:05arkanoiddlesnoff, wow, no thanks, don't want to re-create the wheel for tests
14:02:30arkanoidhuantian: thanks! didn't know about alternative test frameworks. I only know unittest and testament
14:05:48FromDiscord<dlesnoff> @Arkanoid Sorry for the very bad proposition. There are other tests framework: https://github.com/ringabout/awesome-nim#testing
14:06:24arkanoiddlesnoff, no problem! It was not really a bad proposition, just an admission of my lazyness :P
14:06:34FromDiscord<dlesnoff> But you can have a look in the #nimble channel where we discussed about testing framework
14:06:59arkanoidvindaar: it works! I have many "imported and not used" in my test_all.nim, but I get a much faster and nicer output
14:07:29arkanoidI've also solved the vscode issue by adding src/myproject.nim and tests/test_all.nim as projects in my settings.json
14:07:33arkanoidall good! thanks
14:08:43FromDiscord<dlesnoff> In reply to @arkanoid "<@150345911057252352>: it works! I": since these are hints, you may try --hints:off or something more selective
14:10:16arkanoidI like hints and I generally want to keep them on. Is it possible to turn them off for test_all.nim only?
14:11:03FromDiscord<vindaar> ah, thanks! Had forgotten about that, as I hardly ever use `collect`↵(@pietroppeter)
14:11:34FromDiscord<dlesnoff> --hints:on|off|list. `on|off` enables or disables hints.↵ `list` reports which hints are selected.
14:12:00arkanoiddlesnoff, I want them all for all files, except one
14:12:03FromDiscord<dlesnoff> --hint:X:on|off turn specific hint X on|off. `hint:X` means `hint:X:on`,↵ as with similar flags. `all` is the set of all hints↵ (only `all:off` is supported).
14:12:41FromDiscord<dlesnoff> I don't know what is X for "imported and not used"
14:14:24arkanoiddlesnoff, it's UnusedImport, I have it as "warningAsError"
14:14:54arkanoidwell, I used to have it, but it gives error in system.nim
14:15:47FromDiscord<dlesnoff> In reply to @arkanoid "<@610977647601909781>, I want them": maybe you can add a .cfg with an if clause and something to get your module filename but I don't find how to get the name of the module you are compiling
14:16:07FromDiscord<dlesnoff> (edit) ".cfg" => "nim.cfg"
14:19:17FromDiscord<! Nilts> Does anyone know a storage option like json except focused on less memory use?
14:19:28FromDiscord<! Nilts> and if i can use it in nim?
14:20:50*vicecea joined #nim
14:21:10PMunchprotobuf?
14:22:12FromDiscord<dlesnoff> @! Nilts There are many serialization options, see e.g. at the end of https://youtu.be/aKg5PxUi_eA?t=2102
14:22:48FromDiscord<dlesnoff> (edit) "https://youtu.be/aKg5PxUi_eA?t=2102" => "[NimConf2022 - Scratch built game](https://youtu.be/aKg5PxUi_eA?t=2102)"
14:22:49FromDiscord<Rika> protobuf is more an on the wire protocol though
14:23:09PMunchSure, but you can just dump the output to a file if you'd like
14:23:17PMunchOpenStreetMap stores data this way
14:23:46PMunchWell, they also have XML. But if you don't want to download a massive file then the protobuf format is the way to go
14:27:04ehmryNilts there is also CBOR and Preserves, which are self describing formats
14:27:17FromDiscord<dlesnoff> In reply to @Jiezron "maybe you can add": @Arkanoid Sorry I checked and actually you can't be certain of the module name you are compiling, since the name of os.getAppFilename will actually give you the name of the generated C(++)/obj/js file you compile to.
14:27:20FromDiscord<pietroppeter> In reply to @arkanoid "<@610977647601909781>, I want them": I think a pragma {.push hints:off.} at the top of your test file should work, example: https://github.com/bluenote10/NimData/blob/d8b0d9744c3960fd75966e2b71ecc8557a8e31ee/tests/all.nim
14:27:35*arkurious joined #nim
14:30:42FromDiscord<pietroppeter> In reply to @pietroppeter "I think a pragma": (btw using github search for snippets of nim code it can be a nice way to discover code usages 😉 e.g the above was found with https://github.com/search?q=language%3Anim+%7B.push%3Ahints%3Aoff.%7D&type=code)
14:32:18FromDiscord<pietroppeter> and this is the manual for push/pop pragmas https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas
14:32:21arkanoidpietroppeter, seems not handled correctly by nimsuggests, it seems to ignore it completely
14:32:38FromDiscord<pietroppeter> ah, bummer!
14:34:01FromDiscord<ElementalX> sent a code paste, see https://play.nim-lang.org/#ix=4fdq
14:34:31FromDiscord<ElementalX> (edit) "https://play.nim-lang.org/#ix=4fdq" => "https://play.nim-lang.org/#ix=4fdr"
14:34:59FromDiscord<dlesnoff> In reply to @vindaar "cthis is not (even": I compared the sugar.collection version to the array one. For big integers, the sugar.collection is a little bit slower. The seqTo/mapIt version is ofc horrible.
14:36:25FromDiscord<Tanguy> Your first snipped implictly discards the return value of `x`, you have to use `discard x(h)`
14:36:42FromDiscord<dlesnoff> sent a long message, see http://ix.io/4fds
14:36:58PMunch@dlesnoff, not sure what you are discussing. But wouldn't instantiationInfo help?
14:37:53FromDiscord<dlesnoff> In reply to @Jiezron "<@210739784761475072> Sorry I checked": @PMunch are you talking of this ?
14:38:17PMunchYes
14:39:41FromDiscord<ElementalX> In reply to @Tanguy "Your first snipped implictly": Thank you for the help!
14:42:53FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fdu
14:43:30FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4fdv
14:44:05FromDiscord<dlesnoff> But instantiationInfo needs to be inside a template
14:46:39PMunchYeah, you can use it like this: https://play.nim-lang.org/#ix=4fdw
14:46:51PMunchNot sure what the problem of it being inside a template is..
14:47:02FromDiscord<dlesnoff> In reply to @ElementalX "hey <@610977647601909781> ,": Rather than saying that your program does not work, please precise whether you run into an error during compilation or during execution, or whether you got an incorrect output.↵(Even though I could test snippets in my editor).
14:48:30FromDiscord<ElementalX> sure, I would do that, thank you!
14:48:35PMunchHmm, maybe I should auto-import a `module` macro in the playground. So that people can write `module mymodule: echo "Hello world"` and all it does is write the contents to a file by that name with the .nim extension so it can be loaded by the main module
14:53:46FromDiscord<pietroppeter> or write a package with this module macro inside and add it as available packages in playground 🙂 (so people can use it even outside the playground)
14:54:33FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4fdz
14:54:55FromDiscord<Jessa> (edit) "https://play.nim-lang.org/#ix=4fdz" => "https://play.nim-lang.org/#ix=4fdA"
14:55:10FromDiscord<Jessa> (edit) "https://play.nim-lang.org/#ix=4fdA" => "https://play.nim-lang.org/#ix=4fdB"
14:56:30PMunch@pietroppeter, sure, that's probably the cleaner solution :P
14:56:31arkanoidpietroppeter, found it, is "{.warning[UnusedImport]: off.}" at the end of the file
14:56:40arkanoidcheck https://forum.nim-lang.org/t/5461#34187
15:00:28FromDiscord<pietroppeter> In reply to @arkanoid "<@869267093110026320>, found it, is": ah sorry, I did not follow the initial part of the conversation and did not know what you were actually trying to shut off!
15:02:33FromDiscord<pietroppeter> In reply to @PMunch "<@869267093110026320>, sure, that's probably": I would like such a macro 🙂 the only thing that is unclear to me with respect to feasability is: the module macro should write the file at compile time; will the import statement that comes next be able to see the file written a moment earlier?
15:03:20arkanoidI like having problem list clean of hints and warning, but I get some from stdlib. For example times.nim "'parse' cannot raise 'Defect' [XCannotRaiseY]".
15:03:30arkanoidShould I just give up on this?
15:03:49NimEventerNew thread by drkameleon: LinearScanEnd caveats?, see https://forum.nim-lang.org/t/9587
15:04:00PMunch@pietroppeter, sure, that shouldn't be a problem
15:05:03FromDiscord<demotomohiro> @Jessa Calling convension in dll.nim and main.nim is different in your code. That might causig the error.
15:06:04FromDiscord<Jessa> calling convension?↵how do you mean
15:06:52FromDiscord<Bung> https://nim-lang.org/docs/manual.html#types-procedural-type
15:08:56FromDiscord<Jessa> i.. think i'm too tired at the moment to really understand anything that i'm reading↵maybe 3 hours wasn't enough haha↵↵i'll look through that documentation later, i suppose
15:09:21PMunch@Jessa,
15:09:29PMunchhttp://ix.io/4fdW
15:09:31PMunchThat works
15:10:37FromDiscord<pietroppeter> In reply to @PMunch "<@869267093110026320>, sure, that shouldn't": I guess it should be something more sophisticated than this, then (does not work on playrgound nor locally): https://play.nim-lang.org/#ix=4fdV
15:11:40PMunchA couple of things you missed, exportc/dynlib to make sure the symbol is exported correctly (no name mangling). Type signatures need to match exactly, having var in one definition and not in the other causes issues becaues it informs Nim how it is supposed to pass the data. And when doing things with dynamic libraries it is best to use ARC/ORC otherwise you'll need to link to the garbage collector as a separate library from both modules
15:11:50PMunchAt least I think ORC/ARC should work without requiring that..
15:12:32FromDiscord<Jessa> I see
15:14:06PMunch@pietroppeter, https://play.nim-lang.org/#ix=4fdX
15:14:08PMunchThat works fine
15:14:24FromDiscord<Bung> why PMunch text in grey color am using Element
15:14:37FromDiscord<Jessa> sent a long message, see http://ix.io/4fdY
15:15:17*derpydoo quit (Ping timeout: 252 seconds)
15:15:48PMunch@Bung, because I'm a bot, bleep-bloop
15:16:28FromDiscord<Bung> ok, I see
15:16:29PMunch@Jessa, ah if you used those then it was probably just the var missing which tripped you up
15:16:53PMunchEssentially that makes Nim pass a pointer to the variable on the caller stack so it can be modified in-place
15:17:25FromDiscord<pietroppeter> In reply to @PMunch "That works fine": ah nice, indeed my snippet locally does not work when using `nim r` but works with `nim c -r` (which I guess makes sense since nim r uses a temp folder)
15:17:29PMunchAnd ORC/ARC are the new memory management schemes that will become default in Nim 2.0
15:17:57FromDiscord<Jessa> In reply to @PMunch "<@268111216277323779>, ah if you": Cool! ↵good to know, don't think i'll miss that next time now :P
15:18:52FromDiscord<Jessa> In reply to @PMunch "And ORC/ARC are the": and, i see. I don't know much about the memory management side of the language, or any language for that matter.↵↵How influencial would it be?
15:20:31PMunchNot sure what you mean by how influential it will be
15:21:09PMunchIt makes interop, threading, and dynamic libraries easier
15:21:16PMunchBut I've gotta go
15:21:18*PMunch quit (Quit: Leaving)
15:25:24FromDiscord<Jessa> i see, thank you for your help
15:54:34NimEventerNew post on r/nim by nim_rod_: How to write performant Nim?, see https://reddit.com/r/nim/comments/yor0ue/how_to_write_performant_nim/
16:08:50FromDiscord<Cheesy Brik> Type for seq’s with multiple types?
16:09:58FromDiscord<dlesnoff> In reply to @Rika "Then avoid excessive indirection,": I asked about the same question as the Reddit post yesterday and got a nice answer from @Rika and @auxym .
16:10:18FromDiscord<demotomohiro> In reply to @Cheesy Brik "Type for seq’s with": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark
16:36:49*PMunch joined #nim
16:43:51FromDiscord<planetis> nice
16:43:57FromDiscord<planetis> (edit) "nice ... " added "faq"
16:44:13FromDiscord<demotomohiro> thank you!
16:53:55*vsantana joined #nim
16:54:17*vsantana quit (Remote host closed the connection)
17:01:53FromDiscord<untoreh> mmh, `std/xmltree` uses `std/strtabs` for attributes, but strtabs doesn't preserve the order, it always seem to sort alphabetically by keys (attr names) so you end up with mismatching I/O
17:05:24*derpydoo joined #nim
17:08:41FromDiscord<untoreh> well not alphabetically but still
17:36:55FromDiscord<Slazaa> Hi, how can I change the path I want my executable to be compiled to ?
17:39:37FromDiscord<Elegantbeef> `--outdir:/here/you/go`
17:39:47FromDiscord<Slazaa> Thank you :3
17:40:09FromDiscord<Slazaa> It doesnt show on the help command
17:40:14FromDiscord<Slazaa> (edit) "doesnt" => "doesn't"
17:40:19FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html
17:40:30FromDiscord<Slazaa> Thanks :D
17:40:33FromDiscord<Slazaa> That's the link I needed
17:41:24FromDiscord<ShalokShalom> @Slazaa --outdir:DIR
17:41:41FromDiscord<ShalokShalom> Ah, too late ^^
17:42:12FromDiscord<ShalokShalom> @Elegantbeef#0000 Is this intended, that it doesnt show up with the help command?
17:42:30FromDiscord<Elegantbeef> How am i supposed to know
17:48:30FromDiscord<dlesnoff> In reply to @Slazaa "It doesn't show on": Doesn't it show with ’--fullhelp’ ?
17:48:55FromDiscord<dlesnoff> (edit) "’--fullhelp’" => "'--fullhelp'"
17:48:58FromDiscord<Slazaa> In reply to @Jiezron "Doesn't it show with": Oh I didn't know about this command
17:49:23FromDiscord<Slazaa> Yeas it does
17:49:39FromDiscord<Slazaa> (edit) "Yeas" => "Yes"
17:50:31FromDiscord<dlesnoff> —fullhelp does show when outputting nim -h or nim —help
17:51:11FromDiscord<Slazaa> Yeah, I just assumed all commands were shown with a simple help
17:51:36FromDiscord<dlesnoff> But maybe we should add --outdir to --help since it is frequent to search for it.
17:52:04FromDiscord<Slazaa> Thanks for this info :3
17:52:33PMunchThe fuck.. Copied some C code from a pdf and converted it to Nim. Apparently it used en-dashes instead of minuses..
17:56:28FromDiscord<dlesnoff> Try to copy a code from a pdf is hell, especially on linux. It depends heavily on the backend of your viewer like mupdf or poppler.
17:57:09FromDiscord<dlesnoff> (edit) "Try to copy" => "Copying" | "hell," => "deceptive,"
17:59:41FromDiscord<dlesnoff> I wonder if there are tools to extract text from a pdf, it may help
18:06:50FromDiscord<dlesnoff> In reply to @PMunch "The fuck.. Copied some": You can always apply some sed to change all en-dash to minuses
18:06:54FromDiscord<auxym> I have used this in the past to extract data tables from PDFs, worked great. Not sure how it would do with code? https://tabula.technology/
18:07:02PMunchYeah, that's what I did
18:07:13PMunchOr rather I used search and replace in Vim
18:09:37FromDiscord<Elegantbeef> Typical vim users telling you they use vim
18:10:22FromDiscord<Elegantbeef> You dont hear anyone say "I used search and replace in Netbeans IDE 15.3.2"
18:11:43FromDiscord<dlesnoff> You probably mean hyphen, because there is a minus sign and that is not the same symbol … (and we use hyphens to represent minus)
18:13:27FromDiscord<auxym> beef is such a typical KATE user
18:13:29FromDiscord<auxym> 🙂
18:16:43FromDiscord<dlesnoff> I guess it is time for a novel entry in your vimrc:↵nnoremap <F2> :%s/—/-/g<CR>
18:17:55FromDiscord<dlesnoff> But I guess you already did it
18:18:11*phytolizer joined #nim
18:18:58phytolizerhey guys -- i'm trying to make a fully static executable with nim, and have almost succeeded. however, my code uses std/db_sqlite, and is attempting to load the lib dynamically. how can i make it not call dlopen?
18:19:19FromDiscord<Elegantbeef> `--dynLibOverride` explained on the nimc manual
18:19:31*kevinsjoberg left #nim (#nim)
18:19:45FromDiscord<dachian> Is it possible to incorporate Nim's compiled C code into a foreign language's cffi?
18:21:22FromDiscord<Elegantbeef> What do you mean?
18:21:32FromDiscord<Elegantbeef> Can you make libraries using Nim?
18:22:49FromDiscord<dachian> So for example Dart and python have cffis which allow you to call c functions and wrap them with a dart or python interface
18:23:06FromDiscord<Elegantbeef> Yes you can expose Nim code as a system library
18:23:14FromDiscord<Elegantbeef> `--app:lib` and `exportC`
18:23:41FromDiscord<dachian> oh cool thx let me try that real quick and get back
18:24:13FromDiscord<Elegantbeef> Pixie for instance is accessible from python and C using genny
18:24:23phytolizerthanks @Elegantbeef
18:24:25*phytolizer quit (Quit: Client closed)
18:25:59FromDiscord<dachian> In reply to @Elegantbeef "Pixie for instance is": so is it better practice to use genny or --app:lib exportC
18:26:15FromDiscord<dachian> or do u use genny in combination with the above
18:26:36FromDiscord<Elegantbeef> Well without genny you have to manually make type definitions
18:26:50FromDiscord<auxym> genny basically automates the exportC process / makes it easier to use
18:27:01FromDiscord<auxym> so your choice if you want to do it manually or let genny do it for you
18:27:14FromDiscord<Elegantbeef> You still need `--app:lib` or `--app:staticlib` depending on what you're after
18:29:26termerORC GC seems to cause so many problems
18:29:34termerhttpbeast is broken with it
18:29:51termerand I've been having issues with db_sqlite with it
18:30:11termerit looks like my database instance is getting GC'd even though it's top level and never goes away
18:30:22termerthis happens when working with async code
18:30:44FromDiscord<Elegantbeef> Do you have any threading?
18:30:55termerin my sqlite test, no
18:31:05termerhttpbeast has threading
18:31:15termerare there best practices for threading with orc
18:31:37termerI've had some memory-leaking code possibly related to either sqlite or the way I'm doing threading in another project
18:32:01FromDiscord<Elegantbeef> I cant really say more than i did yesterday, i dont use threading or async
18:32:18termerguess my memory is poor
18:32:59FromDiscord<Elegantbeef> When using global heap allocated memory you will likely need to use `{.cast(gcSafe).}:` and `let myVar {.cursor.} = myCollection[ind]`
18:33:21termerwhat is the behavior of gcSafe and cursor
18:33:24termerI've seen gcSafe before
18:33:26termernot cursor though
18:33:35FromDiscord<Elegantbeef> Or using the `threading` module
18:34:00FromDiscord<Elegantbeef> cursor creates an unowned reference, which means the ref counter isnt touched when destroyed
18:34:21FromDiscord<Elegantbeef> https://github.com/nim-lang/threading is likely the best threading experience for orc
18:34:33termerjust pulled that up when searching
18:34:41termerdoes it have pre-generated docs or do I need to run nimdoc
18:35:00FromDiscord<Elegantbeef> There are 3 modules
18:35:26termerI'll take a look at it then
18:35:30FromDiscord<Elegantbeef> It's like \< 1000 loc with doc comments
18:35:55termerthe memory leaks and crashes under orc have been driving me crazy so hopefully this helps
18:36:21termerthe alternative to threading is just running single-threaded, and at that point I'd just use nodejs
18:36:26FromDiscord<Elegantbeef> It's likely just you're accidently sharing ownership of resources which causes deallocation
18:36:41FromDiscord<Elegantbeef> The segfaults come from orc's procedures eh?
18:36:54termerusually a use a pointer to a channel which was made with createShared
18:37:04termerthat's how I do cross-thread communication
18:37:08termeror queue
18:37:11termernot channel
18:37:20termersame concept though
18:38:48FromDiscord<Elegantbeef> Yea channels are nice
18:38:48FromDiscord<Elegantbeef> Will be nicer soon with isolated
18:39:10FromDiscord<Elegantbeef> Well one has a lock 😛
18:39:24termerI need to look through the code and see which I used
18:39:30termerI'm pretty sure I used a channel
18:39:47termerthere's a project I was working on but stopped because of severe threading and memory issues
18:40:01termerso I'm trying to resolve those issues before returning to it
18:40:29*PMunch quit (Ping timeout: 260 seconds)
18:40:39FromDiscord<Horizon [She/Her]> How do i access a private field of an object? Iirc that was doable but can't remember how
18:41:03FromDiscord<Elegantbeef> I slap you and say `std/importutils`
18:41:58FromDiscord<Horizon [She/Her]> Aah, i was googling `Nim access hidden field in object` and `Nim access hidden field` but searching in any Nim documents for the word `private` gave nothing
18:42:08FromDiscord<Horizon [She/Her]> Thanks beef aha
18:42:13FromDiscord<Elegantbeef> Why google
18:42:20FromDiscord<Elegantbeef> https://nim-lang.org/docs/theindex.html exists
18:42:46*pro joined #nim
18:42:57FromDiscord<Horizon [She/Her]> God the loading times are abyssmal on chrome
18:43:04termerhttps://github.com/nim-lang/threading/blob/master/tests/tchannels_simple.nim
18:43:12termerNo allocShared0/createShared
18:43:16termerInteresting
18:43:17FromDiscord<Horizon [She/Her]> But thanks!
18:43:43FromDiscord<Elegantbeef> The channels are global and dont have any heap allocated portion
18:43:55termernow that's sweet
18:44:08FromDiscord<Elegantbeef> Well Nim managed heap allocation
18:44:23FromDiscord<Elegantbeef> You can do the same with the present channels
18:44:55FromDiscord<Elegantbeef> You only need to pass a `ptr Channel` if you want each thread to have it's own channel
18:45:14termerusually I just use channels for passing work to/from a worker thread
18:45:18termerlike in the case of sqlite
18:45:27termerI need to perform queries without blocking an HTTP thread
18:45:32FromDiscord<Elegantbeef> So then a global channel could work
18:45:40termerit should
18:46:10termerwhen you have a single thread to do a type of work then it would work perfectly I'd imagine
18:46:39termerand assuming locks are working right, there should be no problem expanding the number of workers
18:50:10FromDiscord<auxym> I really hope this whole threading/channels situation gets way better in 2.0. Sounds like sort of a mess atm
18:50:19termerit's terrible
18:50:26termerif you throw async into the mix it becomes a nightmare
18:50:47FromDiscord<Elegantbeef> I honestly dont know what's wrong with channels 😄
18:50:55FromDiscord<Elegantbeef> I've used them before and it worked just fine
18:51:03termernothing's wrong except there are magical things that make memory do funny things in orc
18:51:08termerand cause crashes if you're not careful
18:51:17FromDiscord<Elegantbeef> isolated should make channels 0 cost even in orc
18:51:33termerI'll have to check things out and make sure they're working right
18:52:12FromDiscord<auxym> never really needed/used them. But as I understand we have two channels implementations? The stdlib and threading? And threading isn't documented? And sometimes you have to use ptr Channel, for reasons? And all of this is poorly documented?
18:52:38FromDiscord<Elegantbeef> It's not for reasons
18:53:11FromDiscord<Elegantbeef> You need `ptr Channel` if you want to pass a specific channel to a thread, it's that simple
18:53:32FromDiscord<Elegantbeef> Threading is the future of Nim's threading and is still under development, it is documented though
18:53:40*PMunch joined #nim
18:53:42FromDiscord<auxym> In what other case would you ever want a channel, other than passing it to a thread?
18:53:58FromDiscord<Elegantbeef> When you have a global channel that's used as a queue for worker threads
18:54:24FromDiscord<Elegantbeef> You dont need to pass a channel anywhere, you just access the channel directly in that case
18:54:35FromDiscord<auxym> don't you still have to pass a ref/ptr to the channel to each thread though?
18:54:36FromDiscord<auxym> Oh
18:55:07FromDiscord<Elegantbeef> Channels are stack allocated types(well the data is heap allocated but it's managed by the thread)
18:55:18termerPMunch I watched your talks on running Nim on microcontrollers
18:55:26FromDiscord<auxym> Still, in general the idiomatic nim way is to never use ptr, so having to use ptr for channels as the standard use case feels sort of weird
18:55:35termerthose were very eye-opening, since I was convinced nim wasn't suitable for devices like that
18:55:39FromDiscord<Elegantbeef> managed by the channel\
18:55:58FromDiscord<Elegantbeef> I mean we're talking about threading
18:55:59FromDiscord<Elegantbeef> If you get stuck on pointers while you're attempting to thread i'm a bit scared of your generated threaded code
18:56:07FromDiscord<auxym> Anyways, ty for the info. I should try out threading sometime. Good news if threading is under active development and gets better in the future
18:56:46FromDiscord<Elegantbeef> With orc/arc you might(I dont know if this is true) be able to pass `ref Channel`
18:57:11FromDiscord<Elegantbeef> Eh that seems unlikely though
18:57:17FromDiscord<auxym> In reply to @Elegantbeef "If you get stuck": my only experience with threads TBH is python, and you don't need to know anyhting about pointers. A thread-safe Queue is provided as a high-level sync primitive which takes care of most things without fuss
18:57:50FromDiscord<Elegantbeef> Something about python's evaluator being single threaded here
18:58:01FromDiscord<auxym> yes, yes, GIL, etc 🙂
18:58:20FromDiscord<Elegantbeef> When you dont have code running at the same time it's a bit easier to manage
18:59:01FromDiscord<Elegantbeef> Nim threading has you dealing with code running at the same time so it requires some thought into what you're doing, mainly with regard to memory management
18:59:04FromDiscord<auxym> from my understanding, python Queues would still be thread-safe in the absence of the GIL. They are synchronized by OS-level locks/condition vars, under the hood
18:59:08FromDiscord<Elegantbeef> It's extremely easy to have race conditions with memory management
18:59:19FromDiscord<Elegantbeef> Sure and channels are threadsafe
18:59:21*jkl quit (Quit: Gone.)
18:59:34termerany of my threading experience before nim was Java, which handles it all for you
18:59:41FromDiscord<auxym> yes but pointers 😠
18:59:48termeryou only really have to use the proper thread-safe List implementations and the `synchronized` keyword
19:00:02FromDiscord<auxym> In reply to @termer "any of my threading": yeah. exactly.
19:00:54*jkl joined #nim
19:01:26FromDiscord<Elegantbeef> Meh pointers arent that scary
19:01:45FromDiscord<auxym> I know, just doesn't feel like very idiomatic Nim
19:02:20FromDiscord<auxym> Nowhere else in the stdlib is the "normal" way to things requires ptr (other than c ffi obviously)
19:02:21FromDiscord<haywireSSC> how would I iterate through file names in a directory in compile time? would I need to use staticExec and ls command?
19:02:30termerpointers aren't scary
19:02:34termerGC with pointers is scary
19:02:44Amun-RahaywireSSC: that, tbh, makes little sense
19:02:54Amun-RahaywireSSC: unless directory contents are fixed
19:03:36FromDiscord<Elegantbeef> You can do `import std/os` and `walkFiles` assuming your target OS supports `std/os`
19:03:57FromDiscord<haywireSSC> In reply to @Elegantbeef "You can do `import": do most things like that also work in compile time?
19:04:25Amun-Rayes
19:04:26FromDiscord<auxym> @haywireSSC see listDirs and listFiles in https://nim-lang.org/docs/nimscript.html#listDirs%2Cstring
19:04:35FromDiscord<haywireSSC> ty
19:05:33FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#ix=4feX
19:07:14FromDiscord<auxym> you could pass topolist/visited as `var` arguments to buildTopoList. But your current impl looks good to me, too.
19:07:57termera surprising amount of things work at compile time
19:08:30FromDiscord<ezquerra> Would it be as (or perhaps more) efficient one way or the other??
19:09:12FromDiscord<auxym> benchmark it if you want a real answer. OTOH I wouldn't expect a significant difference
19:09:54*ttkap joined #nim
19:12:11FromDiscord<ezquerra> Thanks!
19:20:09FromDiscord<Elegantbeef> A lot do if your target os supports them↵(@haywireSSC)
19:20:24FromDiscord<Elegantbeef> It's a bit of a chore if you're targetting embedded
19:21:25*deadmarshal quit (Ping timeout: 246 seconds)
19:24:40FromDiscord<auxym> yeah. shouldn't CT stuff use hostOS rather than targetOS though, for any cross compilation stuff?
19:31:02*deadmarshal joined #nim
19:36:17FromDiscord<haywireSSC> In reply to @Elegantbeef "A lot do if": it says cannot importc variable at compile time
19:37:06*pro quit (Quit: pro)
19:39:01FromDiscord<haywireSSC> for glob
19:40:28FromDiscord<haywireSSC> In reply to @auxym "<@536164435136479232> see listDirs and": how would I use these?
19:41:32FromDiscord<dlesnoff> I have a question about nim v2. If strictDefs requires initialization of variables and becomes the default, does that mean that each field of our objects must be initialized too ?
19:41:46FromDiscord<ShalokShalom> sent a long message, see http://ix.io/4ff4
19:42:05FromDiscord<auxym> In reply to @haywireSSC "how would I use": IIRC, the nimscript module is always available (like system) for anything running in the VM
19:42:29FromDiscord<ShalokShalom> Does this mean, I can just load Lua libraries, or write Lua code and load that like I load Nim code?↵↵Treat Lua code as native code?
19:42:59FromDiscord<ShalokShalom> Similar to Nimpy?/
20:25:58FromDiscord<tangonov> What a beauty, color syntax examples, too https://media.discordapp.net/attachments/371759389889003532/1039274533594615828/IMG_20221107_122220639_HDR.jpg
20:26:45*xet7 quit (Remote host closed the connection)
20:35:48*krux02 joined #nim
20:43:42*krux02 quit (Remote host closed the connection)
20:44:19*krux02 joined #nim
20:44:28*LuxuryMode quit (Quit: Connection closed for inactivity)
20:52:09FromDiscord<albassort> Should I buy that book for my bookshelves
20:52:20FromDiscord<albassort> I don't really think it has much information for me at this point but I still want it
20:52:34FromDiscord<albassort> Maybe I can destroy it at someone when they tell me that they never heard of him and it's not a real system language
20:52:42FromDiscord<albassort> (edit) "destroy" => "throw"
20:54:47FromDiscord<Phil> Mastering nim is an eternal pain for me. On if I'm too lazy to cancel my patreon contributions for 2 months to get the book or not
20:55:05FromDiscord<Phil> So far the lazyness has won
20:56:04FromDiscord<ShalokShalom> See it as a contribution
20:56:22FromDiscord<Elegantbeef> Yea not all of them↵(@haywireSSC)
20:56:35FromDiscord<Elegantbeef> It's not for `static` evaluated code↵(@auxym)
20:56:54FromDiscord<ShalokShalom> Its doesnt really matter, if you buy the book or contribute the money ↵↵The book costs are minimal, the income for Andreas/the project will be similar
20:57:10FromDiscord<ShalokShalom> @Phil
20:57:19FromDiscord<Elegantbeef> Book probably gives more than patreon
20:57:38FromDiscord<Elegantbeef> Patreon takes a larger cut than publishers/printers likely but idk
20:58:18FromDiscord<Phil> Something in my brain refuses the double dip
20:58:35FromDiscord<Phil> So its a matter of lazyness
21:00:38FromDiscord<ShalokShalom> In reply to @Elegantbeef "Patreon takes a larger": Ah, yeah true. Forgot that Patreon even takes something.
21:00:58FromDiscord<ShalokShalom> And with buying the book, you show interest in the language too
21:01:11FromDiscord<ShalokShalom> Andreas can then say, xx people bought my book.
21:05:03FromDiscord<haywireSSC> In reply to @Elegantbeef "Yea not all of": do you think I would need to run commands to list files and iterate over their output insted?
21:05:33FromDiscord<Elegantbeef> `walkFiles` works
21:05:43FromDiscord<Elegantbeef> Sorry `walkDir`
21:06:52FromDiscord<haywireSSC> oke
21:07:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffm
21:07:34FromDiscord<haywireSSC> thanks!!
21:08:21FromDiscord<Slazaa> sent a code paste, see https://play.nim-lang.org/#ix=4ffn
21:08:33FromDiscord<Slazaa> Here I'd like the first echo to get me Derived basically
21:08:37FromDiscord<Elegantbeef> `Derived(ob)`
21:08:52FromDiscord<Elegantbeef> `proc showType[T: Base](obj: T)`
21:09:07FromDiscord<Slazaa> Oh ok :o
21:09:22FromDiscord<Elegantbeef> Nim's `type`(really you should be using `typeof`) is static and does not know about runtime
21:09:27FromDiscord<Slazaa> Yeah it works thank you :3
21:09:58FromDiscord<Elegantbeef> the above makes the procedure generic and constrains to all subtypes of `Base`, so when you call it with a subtype it generates a new procedure specifically for that
21:10:32FromDiscord<Slazaa> And why does the condition is true though ?
21:10:33FromDiscord<ShalokShalom> Why typeof instead type?
21:10:38FromDiscord<Slazaa> (edit) "does" => "is" | removed "is"
21:10:48FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/ogN
21:10:49FromDiscord<Elegantbeef> cause `of` is runtime
21:10:54FromDiscord<Slazaa> :o
21:11:18FromDiscord<ShalokShalom> Runtime, as in dynamic typing?
21:11:21FromDiscord<Elegantbeef> Cause `typeof` is supposed to be used in typing expressions as it's more clear and doesnt overload a existing word, and it can take parameters
21:11:34FromDiscord<Slazaa> sent a code paste, see https://play.nim-lang.org/#ix=4ffp
21:11:43FromDiscord<ShalokShalom> Ah
21:11:45FromDiscord<Elegantbeef> The 'correct' solution is to make a method to do what you want
21:13:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffq
21:13:34FromDiscord<Elegantbeef> Nim does not really have mechanisms to get the name of a type at runtime, without bodging around
21:13:51FromDiscord<Elegantbeef> It's "Possible" but it's a bit of a bodge
21:14:23*derpydoo quit (Quit: derpydoo)
21:18:41NimEventerNew thread by mantielero: C++ binding - error: use of deleted function, see https://forum.nim-lang.org/t/9588
21:30:12FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffu
21:31:05FromDiscord<Elegantbeef> Is this perhaps a call from inside a generic procedure?
21:31:17FromDiscord<Elegantbeef> Your provided example works fine
21:31:21*jjido joined #nim
21:31:34FromDiscord<geekrelief> yeah the provided examples should work and has worked fine
21:31:51FromDiscord<geekrelief> @jmgomez and I came across this issue while working on NimForUE
21:32:06FromDiscord<Elegantbeef> What's the procedure calling the stringification that is bugging?
21:32:07FromDiscord<Elegantbeef> Is it a generic?
21:32:07FromDiscord<geekrelief> there's been a bunch of commits between when it was working to where it's now broken
21:32:43FromDiscord<geekrelief> we're just calling `$` directly on a type
21:33:07FromDiscord<geekrelief> let me get a code sample for context
21:33:14FromDiscord<Elegantbeef> Not inside any procedure, just at top level?
21:33:22FromDiscord<geekrelief> it's inside a procedure
21:33:33FromDiscord<Elegantbeef> Are you sure the `$` is in scope of the calling procedure?
21:34:02FromDiscord<geekrelief> yeah, I can call the `$` on the type directly, but if the type is in a `seq` it doesn't call it
21:34:17FromDiscord<geekrelief> I have no idea what's causing it to break
21:34:41FromDiscord<geekrelief> https://github.com/jmgomez/NimForUE/blob/d8c307e94be4bdf3beda0edec7287be9ab92c0e7/src/nimforue/examples/examplescodegen.nim#L225
21:35:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffw
21:35:24FromDiscord<geekrelief> we're just calling it here and writing the output to a file, if I drill into `ueProject`...
21:35:39FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffx
21:36:02FromDiscord<Elegantbeef> Oh that's not a generic so that mixin wont do
21:36:34FromDiscord<geekrelief> I have a macro generating the `$` procs
21:36:55FromDiscord<geekrelief> https://github.com/jmgomez/NimForUE/blob/master/src/nimforue/macros/makestrproc.nim this was working fine before
21:37:08FromDiscord<geekrelief> something else around it changed and broke it
21:37:14*jmdaemon joined #nim
21:37:38FromDiscord<Elegantbeef> What's wrong with Nim's `$` you dont like that it lacks type name?
21:37:52FromDiscord<Elegantbeef> or you dislike that it does `"..."` for pointers?
21:37:54FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffy
21:38:05FromDiscord<geekrelief> yeah we need the type name because we're writing the output to a nim file
21:38:17FromDiscord<geekrelief> it gets processed to produce C++ bindings
21:38:43FromDiscord<Elegantbeef> So why not just do `strformat` `{typeof(V)}{$v}` ?
21:39:20FromDiscord<geekrelief> does that work recursively?
21:39:29FromDiscord<geekrelief> I guess I can try it
21:39:32FromDiscord<Elegantbeef> As long as there isnt a pointer
21:39:34FromDiscord<geekrelief> yeah I didn't think of it
21:40:04FromDiscord<geekrelief> but the question still is why would the type in a seq break?
21:40:29FromDiscord<Elegantbeef> Can only imagine the issue is generic binding
21:40:59FromDiscord<Elegantbeef> Inside your `makeStrProc` perhaps a `mixin` would resolve this
21:41:06FromDiscord<geekrelief> can you elaborate on what is generic binding?
21:41:30FromDiscord<Elegantbeef> Generic procedures bind symbols open or closed depending on overloads in context
21:42:07FromDiscord<Elegantbeef> Your `ueProject`'s `$` is likely calling `$` for `seq[T]` and cause it doesnt mixin `$` it's only searching for procedures in it's original scope
21:42:10FromDiscord<Elegantbeef> So your overloads are not found
21:42:28FromDiscord<Elegantbeef> A forward declaration may also help
21:42:40FromDiscord<Elegantbeef> It's quite hard to say with your macros
21:42:55FromDiscord<geekrelief> ok, I'll look into mixin, thanks for the suggestions!
21:43:29FromDiscord<Elegantbeef> You may want to just look into templates and disruptek's assume for easing headaches
21:43:50FromDiscord<Elegantbeef> He has a `typeit` macro that allows iterating fields of a type regardless if it's a object variant
21:44:22FromDiscord<geekrelief> In reply to @Elegantbeef "You may want to": thanks I'll take a look if `mixin` fails to do the trick
21:46:38FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffA
21:47:04FromDiscord<Elegantbeef> Sounds like a nice fun program
21:47:48FromDiscord<geekrelief> lol
21:50:39FromDiscord<Elegantbeef> Looking at what your `$` does i'm fairly certain you can replace it with much simpler macro-less operators
21:51:13FromDiscord<Elegantbeef> The objects you use `makeStrProc` for are not complex types(well one has an object variant, but nim works with `$` on object variants)
21:58:14FromDiscord<geekrelief> In reply to @Elegantbeef "The objects you use": yeah, right I'm trying this:
21:58:45FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffG
21:58:55FromDiscord<geekrelief> but getting an ambiguous `$` error for object or T
21:59:36FromDiscord<geekrelief> do you know how I could call the object version of `$` on T or is there a better way?
22:00:01FromDiscord<Elegantbeef> Damn it
22:00:05FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffH
22:00:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffI
22:00:19FromDiscord<Elegantbeef> I give up
22:00:39FromDiscord<Elegantbeef> Someone take my keyboard from me
22:01:06FromDiscord<Elegantbeef> `object` and the generic constraint might be comparably specific so you might need multiple `$`s
22:01:16FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffJ
22:02:08FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffK
22:02:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffL
22:02:18FromDiscord<Elegantbeef> Yea like i said they're both generics so equally specific
22:02:40FromDiscord<Elegantbeef> `makeStrProc(T: typedesc)` is proper 😄
22:03:27FromDiscord<Elegantbeef> Even though the type is named specifically it's the same specificity as `object or tuple` it seems
22:03:48FromDiscord<Elegantbeef> Possible RFC or PR there, but typechecker changes are scary
22:04:51FromDiscord<geekrelief> darn getting a "undeclared identifier `system`"
22:05:01FromDiscord<geekrelief> (edit) "`system`"" => "'`system`'""
22:05:20FromDiscord<Elegantbeef> did you leave out the `.` like i did?
22:05:42FromDiscord<Elegantbeef> `system.\`$\`\`
22:05:45FromDiscord<geekrelief> oh .. yeah add the dot
22:05:47FromDiscord<Elegantbeef> God damn it 😄
22:05:48FromDiscord<geekrelief> that worked
22:06:01FromDiscord<Elegantbeef> Mark down is not being kind to me today
22:06:27FromDiscord<geekrelief> ahh no luck, it compiles but produces the same output
22:07:00FromDiscord<geekrelief> I truncated the output
22:07:02FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4ffN
22:07:24FromDiscord<geekrelief> f.signature should be `@[UEField(name: "VertexID"...`
22:07:25FromDiscord<Elegantbeef> Are we sure the place that calls `$` imported the module with `$`?
22:08:02FromDiscord<geekrelief> yeah the makestrproc is being imported
22:09:32FromDiscord<geekrelief> it was working before, and after a bunch of commits it broke. I've been staring at the between the commits, and I don't have a clue what could have broken it. I'm considering just giving the string proc a different name just to work around this, but I want to figure out what's going wrong.
22:09:47FromDiscord<geekrelief> missed a word.. staring at the diff
22:10:30FromDiscord<Elegantbeef> https://wandbox.org/permlink/IbD4hN2Ag3w4rANY i dont know what to say
22:10:46FromDiscord<geekrelief> not to throw any shade, but I didn't write the following commits that led to the breakage 😄
22:10:49FromDiscord<Elegantbeef> It seems you have somewhere where the system `$` is being considered above the one provided
22:10:57FromDiscord<geekrelief> I'm just trying to fix it
22:11:01FromDiscord<Elegantbeef> Well i'll blame whoever used `astGenRepr`
22:11:13FromDiscord<geekrelief> ha
22:13:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4ffO
22:14:38FromDiscord<Elegantbeef> It shouldnt be needed but it really seems like system's `$` is being preferred
22:17:08FromDiscord<geekrelief> right, for some reason system's `$` is being called
22:17:45FromDiscord<geekrelief> if I call `$` on the type directly it works
22:18:10FromDiscord<geekrelief> but for seq[T] where T is my custom type it doesn't call my `$`
22:19:15FromDiscord<Elegantbeef> Wait dollars procs do not mixin `$`...
22:20:09FromDiscord<geekrelief> Well it was working before, but now it's not working.
22:20:28FromDiscord<Elegantbeef> Have you updated your Nim compiler?
22:20:29FromDiscord<geekrelief> I'm defining `$` for seqs
22:20:38FromDiscord<geekrelief> I'm on v1.6.8
22:21:02FromDiscord<geekrelief> I ran into an issue on devel.
22:21:23FromDiscord<Elegantbeef> Where do you define `$`?
22:21:43FromDiscord<geekrelief> in a module called `makeStrProc.nim`
22:22:29FromDiscord<geekrelief> it's being imported before it's used in https://github.com/jmgomez/NimForUE/blob/d8c307e94be4bdf3beda0edec7287be9ab92c0e7/src/nimforue/examples/examplescodegen.nim#L5
22:22:46FromDiscord<Elegantbeef> I dont see you defining `$` for seqs in there
22:22:58FromDiscord<geekrelief> right, I'm not
22:23:11FromDiscord<geekrelief> I didn't before and it was working for seqs
22:23:16FromDiscord<Elegantbeef> Well where are you defining it for seqs
22:24:03FromDiscord<geekrelief> I'm not defining it for seqs, it was working before. Just like your wandbox example.
22:24:24FromDiscord<Elegantbeef> Ok well you said twice you were so 😄
22:24:25FromDiscord<geekrelief> But something is breaking it now.
22:24:35FromDiscord<geekrelief> oh I didn't sorry..
22:24:38FromDiscord<geekrelief> (edit) "didn't" => "did"
22:24:46FromDiscord<geekrelief> I probably need to get some sleep.
22:26:02FromDiscord<geekrelief> anyway, I'm going to step away for a bit. Thanks for trying to help out.
22:26:41FromDiscord<Elegantbeef> No problem
22:26:57FromDiscord<Elegantbeef> I'm like 99% certain this is a generic bug but i dont see any signs of it
22:53:20*phytolizer joined #nim
23:02:15*phytolizer quit (Quit: Client closed)
23:04:24*PMunch quit (Quit: leaving)
23:05:57*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
23:29:26*xet7 joined #nim
23:40:18*jmd_ joined #nim
23:40:54*jmdaemon quit (Ping timeout: 260 seconds)
23:59:50arkanoidHow can I write stack only code? What should I avoid doing, apart from using seqs, tables, and other dynamic collections?