<< 12-05-2023 >>

00:21:11*lumo_e quit (Ping timeout: 240 seconds)
00:25:26*lumo_e joined #nim
00:28:39*dooptydoo90x joined #nim
00:43:04*lucasta quit (Remote host closed the connection)
01:03:18*nanxiao joined #nim
01:11:47*lumo_e quit (Ping timeout: 256 seconds)
01:47:55FromDiscord<Nlits (Ping on reply)> does the `js` macro not support arrays?
01:48:02FromDiscord<Nlits (Ping on reply)> seqs
01:52:16*derpydoo joined #nim
02:00:56FromDiscord<Stuffe> is there any way to detect on which OS / CPU you are compiling, in a `static` block?
02:01:24FromDiscord<Stuffe> `when defined(macos):` doesn't seem to work, I guess because its a static block
02:05:21FromDiscord<Nlits (Ping on reply)> In reply to @Stuffe "is there any way": I don't think so, the static sandbox is pretty good.
02:07:20FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4vGs
02:08:48FromDiscord<Stuffe> hmm, i am not sure why but it doesn't seem to trigger on my m1 mac
02:09:04FromDiscord<Stuffe> I use `defined(macos)`
02:09:10FromDiscord<Stuffe> (edit) "`defined(macos)`" => "`when defined(macos)`"
02:09:21FromDiscord<Stuffe> I guess `macos` is the right keyword, right?
02:09:44FromDiscord<Elegantbeef> `macosx` perhaps?
02:11:38FromDiscord<Stuffe> that didn't work
02:11:53FromDiscord<Stuffe> but I just realized I have an enum called macos, let me try renaming some stuff
02:14:25*beholders_eye quit (Quit: WeeChat 3.6)
02:15:01FromDiscord<Stuffe> In reply to @Elegantbeef "`macosx` perhaps?": you were right as well
02:15:05FromDiscord<Stuffe> got it working, thanks!
02:28:08*azimut_ joined #nim
02:28:39*nanxiao quit (Quit: Client closed)
02:30:56*azimut quit (Ping timeout: 240 seconds)
02:35:29FromDiscord<Stuffe> sorry, another question. Is it possible to walk a directory and load contents of files into a table, at compile time?
02:37:08FromDiscord<Stuffe> I am using the static keyword together with `staticRead`, but I can't get the content into a `const` variable
02:48:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vGw
02:55:51FromDiscord<Stuffe> It looks like the sort of thing I want, let me try
02:59:31FromDiscord<Stuffe> I can make a const seq with this, not sure how I could make a table
02:59:46FromDiscord<Stuffe> of course I can just make 2 seqs use indexing
03:00:47FromDiscord<Dudugz> You can create a table, iterate over the seq and add the table
03:00:56FromDiscord<Dudugz> (edit) "You can create a table, iterate over the seq and add ... the" added "tô"
03:01:07FromDiscord<Dudugz> (edit) "tô" => "to"
03:02:10FromDiscord<Stuffe> at runtime or compile time?
03:02:48FromDiscord<Dudugz> I didn't see that the code was static, well I won't know the answer because I don't know if tables can be created at compile time
03:03:00FromDiscord<Stuffe> ok, no worries
03:04:43FromDiscord<Stuffe> I don't know the static table syntax, so I will probably just generate 2 seqs unless someone else does. It's not too pretty but its good enough for what I need
03:12:41FromDiscord<Elegantbeef> The static table is just a table
03:17:17FromDiscord<ringabout> Does clang support `-Wl,--build-id=none`? It gives "ld: unknown option: --build-id=none" or it's the fault of macOS?
03:30:28FromDiscord<ringabout> Whatever, needs to diable it on macOS => https://github.com/nim-lang/Nim/pull/21839
04:04:20*azimut_ quit (Remote host closed the connection)
04:04:51*azimut joined #nim
04:36:08*azimut quit (Ping timeout: 240 seconds)
04:36:48*azimut joined #nim
05:03:05*rockcavera quit (Remote host closed the connection)
05:20:08*azimut quit (Ping timeout: 240 seconds)
05:25:37FromDiscord<Prestige> Is there something weird with generics and using distinct? Trying to figure out what's going wrong here: https://play.nim-lang.org/#ix=4vGN
05:29:55FromDiscord<Elegantbeef> Distincts do not have constructors
05:30:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vGO
05:30:33FromDiscord<Elegantbeef> Is probably what you want
05:32:12FromDiscord<Prestige> Ahh I understand, thank you
05:36:19*advesperacit joined #nim
05:36:59FromDiscord<Prestige> How would I go about making a union between these types? Like `SomeSafeSeq[T] = SafeSeq[T] | OrderedSafeSeq[T]` so I could use either in a function
05:37:22FromDiscord<Elegantbeef> You just did
05:37:55FromDiscord<Prestige> When doing this, access to variables is not working - I'll post an example in a sec
05:38:07FromDiscord<Elegantbeef> Did you borrow `.`?
05:38:22FromDiscord<Prestige> On OrderedSafeSet
05:39:39FromDiscord<Prestige> https://play.nim-lang.org/#ix=4vGP
05:41:25FromDiscord<Elegantbeef> hmm borrow might not work properly with generic distincts
05:42:22FromDiscord<Elegantbeef> Honestly here I'd probably use inheritance
05:43:13FromDiscord<Elegantbeef> Since your safeseq is a reference for whatever reason
05:43:17NimEventerNew post on r/nim by deadkonsumer: Publishing to nimble, see https://reddit.com/r/nim/comments/13fc3ze/publishing_to_nimble/
05:43:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4vGQ
05:43:56FromDiscord<Prestige> hmmm 🤔
05:44:28FromDiscord<Elegantbeef> Although even if your SafeSeq wasnt a ref type inheritance probably would be fine
05:58:31*derpydoo quit (Ping timeout: 240 seconds)
06:15:32*leohoo_sdu[m] joined #nim
06:59:17*mal`` quit (Quit: Leaving)
07:26:12*mal`` joined #nim
09:21:06NimEventerNew thread by cmc: Announce: LimDB 0.3.0 Now with types & block-syntax transactions, see https://forum.nim-lang.org/t/10193
09:48:05NimEventerNew question by KRIZ -ME: I can&#39;t compile a nim + c++ project, see https://stackoverflow.com/questions/76235074/i-cant-compile-a-nim-c-project
10:56:26*jmdaemon quit (Ping timeout: 246 seconds)
11:24:54*Jjp137 quit (Ping timeout: 265 seconds)
11:25:13*Jjp137 joined #nim
13:16:31FromDiscord<&epistemes[..];> sup nimmers
13:17:18FromDiscord<&epistemes[..];> who nimmin' rn
13:27:48FromDiscord<Phil> I'm currently angularin, thus my reduced activity, frontend be keepin ya busy
13:28:15*progranner joined #nim
13:28:40*rockcavera joined #nim
13:29:27*progranner quit (Client Quit)
13:33:08*progranner joined #nim
13:35:06FromDiscord<&epistemes[..];> very nice
13:35:59FromDiscord<&epistemes[..];> personally, I'm currently a zigger
13:36:06FromDiscord<&epistemes[..];> I zig smtimes
13:48:34*PMunch joined #nim
13:49:37PMunchHmm interesting. I have this definition in my code: proc atomic_exchange_explicit[T, A](location: ptr A; desired: T; order: MemoryOrder = moSequentiallyConsistent): T {.importc.}
13:49:44PMunchAnd I call it with two arguments
13:50:20PMunchBut the C compiler complains about this: error: macro "atomic_exchange_explicit" passed 4 arguments, but takes just 3
13:50:29PMunch atomic_exchange_explicit(s, x, ((memory_order) 5), (&T1_));
13:50:40PMunchSo for some reason Nim decides to throw in an extra argument..
13:53:09PMunchIt's probably because I try to use it with a reference to a closure..
13:54:43FromDiscord<jtv> Yes, that'd definitely be the state needed to evaluate the closure, so if you're swapping a function pointer, I'd probably not make it a closure...
14:03:40*rockcavera quit (Remote host closed the connection)
14:04:34FromDiscord<sOkam!> How can I access this from Nim code? Any ideas? 🤔↵https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandlea
14:19:13*rockcavera joined #nim
14:20:50FromDiscord<auxym> In reply to @sOkam! "How can I access": winim
14:20:51FromDiscord<auxym> https://github.com/khchen/winim/blob/3abd0ae122cd41efd0ce6d45fea720ef7091e4ac/winim/inc/winbase.nim#L1834
14:23:17*azimut joined #nim
14:26:12FromDiscord<sOkam!> In reply to @auxym "winim": is it possible to avoid the whole lib, since I only need this one function? 🤔
14:26:39FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4vI0
14:31:21FromDiscord<auxym> nim does DCE, only the code you actually use ends up in your binary. And in this case, it's just a call to a dll, so nothing actually gets added to your binary (or just about)
14:36:46FromDiscord<auxym> also, use `import winim/lean`
14:41:49PMunch@jtv, well the whole reason I was trying to pass a closure was to test my synchronization stuff
14:46:29FromDiscord<sOkam!> In reply to @auxym "nim does DCE, only": im more worried about maintaining a dependency that I won't use, than anything else. that's why I was asking
14:46:47FromDiscord<sOkam!> I just need this one function, and won't touch it again
14:47:16FromDiscord<sOkam!> but asking in case there is some build requirements or something, other than linking to the kernel.lib
15:05:15*Notxor joined #nim
15:16:35FromDiscord<auxym> In reply to @sOkam! "im more worried about": you could probably just copy paste that proc declaration in your code. I think, though that `winapi` pragam may be a macro, you'd have to look into what that does. shouldn't need any other build requirements other than linking to kernel32.dll
15:21:17FromDiscord<demotomohiro> In reply to @sOkam! "im more worried about": You can import win32api in the same way as winlean module: https://github.com/nim-lang/Nim/blob/devel/lib/windows/winlean.nim
15:22:55FromDiscord<sOkam!> In reply to @demotomohiro "You can import win32api": but that doesn't import any of those symbols 🤔
15:25:39PMunchOkay, so this simple synchronization thing works: http://ix.io/4vIg
15:26:08PMunchNow just to find the proper guarantees and such to make it generally safe
15:27:03FromDiscord<caravaggio> Is there a nim opencl library?
15:27:12FromDiscord<caravaggio> The one I came across seems deprecated
15:33:30PMunchUgh, the Nimble pkgs2 stuff is so broken: Output: /home/peter/.choosenim/toolchains/nim-#version-2-0/config/nim.cfg(70, 1) Error: invalid package name: /home/peter/.nimble/pkgs2/fungus-0.1.11-b05d8d33453dbd1bf74eb54f47e5d1830863214a
15:33:55PMunchThat's from just trying to choose the #version-2-0 package..
15:47:09PMunchSeems like updating choosenim fixed it
15:47:38*Notxor quit (Quit: Leaving)
15:49:17FromDiscord<djazz> you havent updated choosenim since June 2022?
15:53:40PMunchThis is my laptop, so probably not
15:55:36FromDiscord<Monolho> how do I cross compile with nake?
15:57:38FromDiscord<Monolho> form linux to windows
16:01:42FromDiscord<jtv> PMunch, the way I'd deal with that in C is I'd be doing atomic swaps on a pointer to a single structure containing the function pointer plus state
16:03:43FromDiscord<jtv> Don't know enough about Nim internals to be helpful sadly
16:06:04PMunch@jtv, that's pretty much exactly what I'm doing in the sample above :)
16:09:11FromDiscord<jtv> From what you're saying, without digging in, it seems like Nim's closure calling convention is to pass the func pointer and state as two params rather than sticking them in one struct
16:09:36FromDiscord<jtv> So to do any type of swap or cas you'd have to get them in a struct yourself I'd assume
16:37:22*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
16:42:46PMunchYup, I just stuck the closure in an object
16:42:54PMunchI shared a paste above
16:43:01PMunchhttp://ix.io/4vIg <- Here it is again
16:44:40PMunchI was just a bit surprised, because the C code generated for a closure is a struct with a callback pointer and a void pointer
16:45:05PMunchSo passing it to a C function I had assumed I would get the object, and not the two pointers added separately
16:55:43*jmdaemon joined #nim
17:00:56*progranner joined #nim
17:38:04FromDiscord<Monolho> sent a code paste, see https://play.nim-lang.org/#ix=4vIJ
17:38:17FromDiscord<Monolho> it tells that the indentation is wrong
17:38:36FromDiscord<Monolho> can I define the var with values already?
17:38:49PMunchFloats need to use a dot as separator and not a comma
17:39:41FromDiscord<Monolho> oh, off course thanks
17:41:07FromDiscord<Monolho> now it tells me that sensitivity is undeclared
17:44:02FromDiscord<Monolho> Error: undeclared identifier: 'sensivity'
17:45:42FromDiscord<Monolho> nevermind gotta use self
17:48:12*lucasta joined #nim
17:49:59*leohoo_sdu[m] quit (K-Lined)
18:04:25*fallback quit (Ping timeout: 256 seconds)
18:13:53*arkurious joined #nim
18:13:54*arkurious quit (Remote host closed the connection)
18:15:19*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:19:30*progranner joined #nim
18:26:03FromDiscord<mratsim> In reply to @caravaggio "Is there a nim": There is one in github.com/nim-lang/opencl it still works since OpenCL APIs are pretty stable
18:34:11*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:35:44*progranner joined #nim
18:38:46NimEventerNew post on r/nim by qtless: Path Params In HappyX, see https://reddit.com/r/nim/comments/13ftbhz/path_params_in_happyx/
18:39:04FromDiscord<Monolho> does anyone who uses godot knows how to get input?
18:39:15FromDiscord<Monolho> how to process input events?
18:42:13*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:45:50*fallback joined #nim
18:47:35FromDiscord<caravaggio> In reply to @mratsim "There is one in": thanks
18:47:55FromDiscord<caravaggio> its just concerning that the last update was 018
18:47:59FromDiscord<caravaggio> ill give it a spin
18:51:55*progranner joined #nim
18:55:24*lucasta quit (Remote host closed the connection)
19:06:05FromDiscord<jtv> Pmunch if you're working w/ atomics, lmk if you want some scalable lock free data structures!
19:11:22*Notxor joined #nim
19:20:24*Notxor quit (Read error: Connection reset by peer)
19:20:32*Notxor joined #nim
19:29:02*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:42:57*progranner joined #nim
19:57:08*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:58:46NimEventerNew thread by hunterbr: Is there a way to tell the compiler to include/export unused functions, see https://forum.nim-lang.org/t/10194
19:59:31*progranner joined #nim
20:34:52*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
21:12:49*Notxor quit (Remote host closed the connection)
21:20:47PMunch@jtv, scalable lock free data structure sounds great!
21:21:04PMunchI'm just toying with usecases where isolated would be nice to have for safety
21:27:17*cm quit (Ping timeout: 256 seconds)
21:32:14*cm joined #nim
21:36:52FromDiscord<auxym> In reply to @jtv "Pmunch if you're working": just fyi but we do have a lock-free scalable mpmc queue: https://github.com/nim-works/loony other structures would be cool too!
21:42:10PMunchHmm, interesting
22:06:20*krux02_ joined #nim
22:12:26FromDiscord<ajusa> In reply to @auxym "just fyi but we": Could this be used instead of channels?
22:47:30*advesperacit quit ()
23:08:33FromDiscord<Nlits (Ping on reply)> sent a code paste, see https://play.nim-lang.org/#ix=4vJD
23:08:37FromDiscord<Nlits (Ping on reply)> then how the f is it longer then 0??????
23:09:23*PMunch quit (Quit: Leaving)
23:09:44FromDiscord<Nlits (Ping on reply)> Full-ish error: https://media.discordapp.net/attachments/371759389889003532/1106719893719625818/message.txt
23:10:31*lucasta joined #nim
23:11:50FromDiscord<that_dude> Isn't that Index not guaranteed? Path[0] is though
23:12:09FromDiscord<Nlits (Ping on reply)> In reply to @that_dude "Isn't that Index not": sdfrgthuyrtigjrfkorejiutgh
23:12:13FromDiscord<Nlits (Ping on reply)> you big brain
23:12:15FromDiscord<Nlits (Ping on reply)> let me fix
23:12:25FromDiscord<that_dude> Lol gl
23:28:23FromDiscord<auxym> In reply to @ajusa "Could this be used": i guess. TBH I haven't dug into multithreading in nim at all so far (mostly because from the outside it looks confusing and a huge pain). from my understanding channels are sort of a single producer/single consumer queue? if so yeah. You might have to use a channel to pass the reference to the loony queue? or use a global? like I said no idea about MT
23:39:18*lucasta quit (Remote host closed the connection)
23:41:05FromDiscord<Elegantbeef> Psh it's only confusing if you forget about moving data, cyclical types, and attempt shared ownership!
23:41:42FromDiscord<Elegantbeef> I joke, but depending on what you're doing it's not too bad
23:41:52FromDiscord<Elegantbeef> Not that i really use multithreading either