<< 16-02-2023 >>

00:01:14FromDiscord<eyes> right right
00:01:22FromDiscord<eyes> sometimes i forget that nim is secretly C and not python
00:28:33FromDiscord<turbo> How can I access a var created as `seq[seq[float]]` as `UncheckedArray[float]`? Right now I'm rewriting the original var into a `seq[float]` and then casting, which works. But I'd like to avoid this copy.
00:31:09FromDiscord<Yepoleb> you can't flatten nested seqs without a copy
00:32:33FromDiscord<Yepoleb> they are not a continuous region of memory because the inner seqs need to be able to grow
00:37:01FromDiscord<turbo> What if the inner seqs are arrays?
00:47:34FromDiscord<Elegantbeef> `cast[ptr UncheckedArray[float]](mySeq[0].addr)`
00:50:56FromDiscord<turbo> Yep that works
00:52:15FromDiscord<turbo> > Error: unhandled exception: int128.nim(69, 11) `arg.sdata(2) == 0` out of range [AssertionDefect]↵Takes the cake as the least helpful error message I've seen in Nim yet. Crops up if you forget the `static` in a generic array type int parameter
00:52:44FromDiscord<Elegantbeef> Well it's not a compiler error message
00:52:50FromDiscord<Elegantbeef> So... yea
00:53:08*azimut quit (Ping timeout: 255 seconds)
01:16:02FromDiscord<opp> How do I skip SSL verification on httpclient library?
01:26:03FromDiscord<opp> sent a code paste, see https://paste.rs/rJH
01:26:16FromDiscord<opp> (edit) "https://paste.rs/lSK" => "https://paste.rs/AGN"
01:34:58FromDiscord<Yepoleb> In reply to @turbo "What if the inner": no, only if both are arrays
01:36:51FromDiscord<Yepoleb> In reply to @Elegantbeef "`cast[ptr UncheckedArray[float]](mySeq[0].addr)`": as i understand it they want to access all the inner seqs continuously as one array, this only works for the elements in the first inner seq
01:39:00FromDiscord<Elegantbeef> If it's `seq[array[T, float32]]` it works
01:39:45FromDiscord<turbo> In reply to @Yepoleb "no, only if both": ^ this, just tested it - all as expected
01:39:56FromDiscord<turbo> ^ this, just tested it - all as expected
01:40:02FromDiscord<Yepoleb> In reply to @Elegantbeef "If it's `seq[array[T, float32]]`": oh, right
01:41:10*xet7 quit (Remote host closed the connection)
01:41:47FromDiscord<Yepoleb> i read that as an answer to `seq[seq[float]]`
02:08:02*derpydoo joined #nim
03:08:41*arkurious quit (Quit: Leaving)
03:14:05*dropkick quit (Ping timeout: 260 seconds)
04:08:12FromDiscord<Iliketwertles> why am i getting an error here? https://media.discordapp.net/attachments/371759389889003532/1075629644172242944/screenshot_2023-02-15-230742.png
04:08:29FromDiscord<Rika> well whats the error
04:08:57FromDiscord<Iliketwertles> `Error: type mismatch: got <string, string>`
04:09:16FromDiscord<Yepoleb> try importing strutils
04:09:30FromDiscord<Iliketwertles> oh
04:09:33FromDiscord<Iliketwertles> that was is
04:09:34FromDiscord<Iliketwertles> (edit) "is" => "it"
04:09:48FromDiscord<Iliketwertles> didnt know that was part of strutils
04:09:50FromDiscord<Yepoleb> had someone with the same problem yesterday 😄
04:10:35FromDiscord<Iliketwertles> weird
04:10:50FromDiscord<Iliketwertles> still outputs all the lines of the pkgs not just the ones with :
04:11:03FromDiscord<Iliketwertles> but it also outputs [IOError]
04:11:09FromDiscord<Iliketwertles> (edit) "but it also outputs [IOError] ... " added "at the end with nothing else"
04:11:22FromDiscord<Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4ocX
04:11:38FromDiscord<Iliketwertles> i only want the top line with : so i can count it
04:12:36FromDiscord<Yepoleb> are you aware of this proc? https://nim-lang.org/docs/os.html#walkPattern.i%2Cstring
04:13:03FromDiscord<amadan> Think you are meant to use splitLines and not lines
04:13:12FromDiscord<amadan> Lines iterates through lines in a file iirc
04:13:41FromDiscord<Iliketwertles> ayy i might have got it
04:13:53FromDiscord<Iliketwertles> it worked
04:13:58FromDiscord<Iliketwertles> splitLines
04:14:17FromDiscord<Iliketwertles> In reply to @Yepoleb "are you aware of": i dont think that would work for like `/some/dir//`
04:16:48FromDiscord<Yepoleb> it most likely would if it works for console commands
04:19:04*rockcavera quit (Remote host closed the connection)
04:21:01FromDiscord<Iliketwertles> my fetch works speedily on gentoo now https://media.discordapp.net/attachments/371759389889003532/1075632871240368168/screenshot_2023-02-15-232040.png
04:47:07FromDiscord<Iliketwertles> sent a code paste, see https://play.nim-lang.org/#ix=4od5
04:47:18FromDiscord<Iliketwertles> (edit) "https://play.nim-lang.org/#ix=4od5" => "https://play.nim-lang.org/#ix=4od6"
04:47:23FromDiscord<Iliketwertles> this got the number i needed
05:34:10FromDiscord<ringabout> Hi FedericoCeratto, what's your opinion of https://github.com/nim-lang/Nim/pull/21292
06:07:28*kenran joined #nim
06:09:44*kenran quit (Remote host closed the connection)
06:31:46FromDiscord<Drygord> Can anyone help with super slow compile time? It's taking 3-4 seconds for a very basic 'hello world' type script.
06:32:14FromDiscord<ringabout> Which is the C compiler you are using?
06:32:40FromDiscord<Drygord> minGW 64
06:33:12FromDiscord<ringabout> Code and Nim version and OS info?
06:33:29FromDiscord<Drygord> 1.9.1, windows 10
06:33:48FromDiscord<Drygord> for code, just imagine `echo "hello world"`
06:38:18FromDiscord<ringabout> `nim c -f test.nim` yields `1.546s` on My Win11
06:39:07FromDiscord<ringabout> Perhaps the Nim hasn't yet cached some stdlibs if you are running the code for the first time/
07:15:27*advesperacit joined #nim
07:35:50FromDiscord<Drygord> Now I am trying on a different machine. this was literally working yesterday. God I hate windows. https://media.discordapp.net/attachments/371759389889003532/1075681896777924608/image.png
07:37:29FromDiscord<Phil> In reply to @Drygord "Now I am trying": nim.exe-directory no longer on the PATH I assume?
07:37:36FromDiscord<Phil> Or did MS-Defender change its mind and wipe your nim install?
07:37:59FromDiscord<Drygord> lol i am investigating now
07:38:23FromDiscord<Phil> In reply to @Drygord "lol i am investigating": Good luck!
07:40:28FromDiscord<Phil> This reminds me that I'll really have to contemplate how I want to deal with the GUI app I'm writing for windows. I don't have a windows PC and even if I can assume that it installs, I'd still somehow need to test it and I'm not even sure if the GUI-testing-lib I found works
07:40:51FromDiscord<Phil> (edit) "This reminds me that I'll really have to contemplate how I want to deal with the GUI app I'm writing for windows. I don't have a windows PC and even if I can assume that it installs, I'd still somehow need to test it and I'm not even sure if the GUI-testing-lib I found works ... " added "on windows"
07:41:16FromDiscord<Phil> (edit) "writing for windows." => "writing, or rather how I want to deal with windows when it comes to it."
07:43:54FromDiscord<Elegantbeef> No clue if you want to crosscompile to windows or not, but it's not that fun for gtk 😄
07:44:03FromDiscord<Elegantbeef> Atleast if you statically do it
07:45:52*jmdaemon quit (Ping timeout: 246 seconds)
07:46:37FromDiscord<Phil> Well, LDTP is apparently a thing and that appears to run on windows AND support gtk.↵Also has python bindings and with numpy that means I have access to LDTP bindings
07:47:00FromDiscord<Phil> For testing I'm willing to eat the more complex setup of having to deal with installing python dependencies
07:56:15FromDiscord<Phil> Actually, couldn't I just use a windows vm to see how my application functions under windows?
07:57:05FromDiscord<Phil> Stuff to ponder for when it becomes relevant in like half a year
08:12:55*azimut joined #nim
08:16:08*PMunch joined #nim
09:12:19FromDiscord<0x454d505459> sent a code paste, see https://play.nim-lang.org/#ix=4odV
09:14:57*advesperacit quit ()
09:19:39*advesperacit joined #nim
09:19:40FromDiscord<Coachonko> Bruh
09:20:15FromDiscord<0x454d505459> yeah
09:21:31FromDiscord<Phil> In reply to @0x454d505459 "Hello there, I need": Hmm I'm trying to figure out how to best elaborate on that.↵How familiar are you with the difference between compileTime and runtime?
09:21:55FromDiscord<0x454d505459> In reply to @Isofruit "Hmm I'm trying to": I can sometime mix them, but that's pretty rare
09:22:11FromDiscord<Phil> Because the answer is "In general no, but you can cheat the system a bit with generics or clever use of e.g. seq"
09:23:00FromDiscord<0x454d505459> I tried using varargs of type auto (don't ask why idk) and it broke the compiler
09:23:25FromDiscord<Phil> In reply to @0x454d505459 "I can sometime mix": So in nim, in the end when all the magic of generics, templates etc. is done, everything has a static type.↵There is no ambiguity, you have a strictly defined e.g. `proc(x: int): str+ing`
09:23:26FromDiscord<Rika> auto varargs would only allow a homogeneous-type arg list
09:24:06FromDiscord<0x454d505459> ik
09:24:19FromDiscord<0x454d505459> I tried on simple functions
09:24:22FromDiscord<Phil> So you can't have type-stuff at runtime, you must know it ahead of time.↵You could use a seq[string] parameter for example to allow users to define a lot of different things, but that means you're necessitating everything you pass in there to be a string
09:24:40FromDiscord<0x454d505459> yeah I thought of that
09:25:19FromDiscord<Phil> You could use generics (which is the direction using auto goes towards), but that still means you must know all the types you want to use this with ahead of time, you're just reducing your copy-paste effort and let the compiler do that for you
09:25:42FromDiscord<0x454d505459> In reply to @0x454d505459 "yeah I thought of": what I could do, is find a way to serialise the data, that way I only pass serialized data and deserialize it after
09:26:05FromDiscord<Phil> It should also be noted that unless the procedure you want to use does not take any input and does not produce any output, `proc()` is not the correct type
09:26:05FromDiscord<0x454d505459> In reply to @Isofruit "You could use generics": feels janky
09:26:23FromDiscord<0x454d505459> In reply to @Isofruit "It should also be": what is it then ?
09:26:39FromDiscord<Rika> a `proc()` is a function with no params and void return
09:26:45FromDiscord<0x454d505459> Yeah ik
09:26:52FromDiscord<Rika> thats what phil said
09:26:59FromDiscord<0x454d505459> ok ok
09:27:54FromDiscord<0x454d505459> i'll try puting everything into a serialized type which will be the one passed and then deserializing it after
09:32:45FromDiscord<0x454d505459> thanks for your help
09:43:00FromDiscord<Phil> In reply to @0x454d505459 "i'll try puting everything": Do you know what the type looks like ahead of time?
09:43:21FromDiscord<0x454d505459> nope
09:43:44FromDiscord<Phil> Ahh yeah, in that case your serialization solution is pretty much your only way forward.↵Hey, this is where JsonNode from std/json excels!
09:43:58FromDiscord<0x454d505459> yeah
09:48:24*dza quit (Quit: )
09:52:57FromDiscord<0x454d505459> I managed to break the compiler lol
09:53:23FromDiscord<0x454d505459> it SIGSEVed for illegal storage access
09:54:42FromDiscord<Phil> SIGSEV always sounds like somebody is accessing nil somewhere
09:54:47FromDiscord<Phil> (edit) "SIGSEV always sounds like somebody is accessing nil somewhere ... " added "to me"
09:54:50FromDiscord<0x454d505459> yeah
09:55:38FromDiscord<Rika> you didnt really break the compiler
09:55:45FromDiscord<Rika> theres just an error you made in the code
09:57:05FromDiscord<0x454d505459> sent a code paste, see https://paste.rs/TcO
09:57:20FromDiscord<Elegantbeef> `: typedesc` and `: auto` are invalid for that type
09:57:20FromDiscord<0x454d505459> In reply to @Rika "theres just an error": thanks I knew this
09:57:28FromDiscord<0x454d505459> In reply to @Elegantbeef "`: typedesc` and `:": oh bruh
09:57:34FromDiscord<Elegantbeef> You're attempting to make a generic type with no generic arguments
09:57:50FromDiscord<Elegantbeef> typedesc cannot exist as a field, it's compile time only
09:58:13FromDiscord<Elegantbeef> `: auto` needs to be replaced with `AType[T] = ...` and `value: T`
09:58:36FromDiscord<0x454d505459> In reply to @Elegantbeef "`: auto` needs to": that's what I was gonna do, but thanks
09:58:47FromDiscord<0x454d505459> it was just for testing anyways
10:02:18*azimut quit (Remote host closed the connection)
10:03:16*azimut joined #nim
10:05:19*PMunch quit (Quit: Leaving)
10:09:52*PMunch joined #nim
10:20:15*dza joined #nim
10:59:56FromDiscord<I have 50GB of nothing on my PC> does anyone here have experience with haxe? what are nim's advantages over it?
11:06:12*Guest35 joined #nim
11:18:53*woofwoof joined #nim
11:20:47PMunchNo experience with it, but from what I can see from their site I'd say that Nim is more flexible
11:21:28PMunchHaxe has a VM and can be interpreted, this means you will likely never hit native performance, even when building for e.g. C
11:21:34PMunchNo meta-programming
11:21:51PMunchWell, it has conditional compilation, but so does C
11:22:13PMunchOh wait, it does have macros it seems
11:22:24FromDiscord<exelotl> Haxe does have AST based macros like Nim
11:22:53PMunchYes I can see that now, but it seems like it's only on untyped nodes?
11:23:01PMunchJudging from this: https://haxe.org/manual/macro.html
11:25:12FromDiscord<exelotl> Haxe has a heavy runtime and less efficient codegen because it's not trying to be a systems programming language. It has more dynamic features, I think it has its roots in ml (ocaml etc). Which means pointers galore and you can't easily turn off the GC
11:31:21woofwoofis there a way to run helloworld.nim without compiling it to .exe first?
11:34:14Zevvnim r helloworld.nim
11:35:28woofwoofit still compiles but to another folder, i.e. nimcache\helloworld_DFCBBF75B1B0E07B277E990CB8CF00E9E7CC4479.exe
11:37:30woofwoofI want to achieve the execution purely in memory, without wearing out the disk
11:39:23PMunchwoofwoof, put the nimcache and binary output in the /tmp folder I guess
11:39:34PMunchAs long as your /tmp folder is mounted as a tmpfs of course
11:40:10PMunchYou can run `nim e helloworld.nim` which executes it as nimscript, but this isn't exactly the same
11:40:30PMunchBut depending on what you're trying to do it might be enough
11:41:33woofwoofI am on Windows, ramdisk is not an option, hmm. yes, 'e' seems to be the very option for my case
11:41:59PMunchBut unless you bought your harddrive on Wish.com you probably shouldn't worry this much about disk writes
11:43:39woofwoofindeed, 'e' enables me to see the output way faster, and by adding --verbosity: "0" to nim.cfg, I see the output without service messages
11:49:27PMunchStill, keep in mind that this is now NimScript, not Nim
12:05:47FromDiscord<Hourglass [She/Her]> (NimScript lacks C interop and FFI, so bindings to C libraries won't work, if it still works for you, great!)
12:05:48FromDiscord<Rika> You will have a somewhat more limited standard library
12:06:04FromDiscord<Rika> And also a more limited number of external libraries you can use
12:44:00*woofwoof left #nim (#nim)
13:22:30FromDiscord<Nerve> If I have a proc with a `varargs` parameter and I want to pass those to another proc with a `varargs` parameter and a similar signature, how would I do that?
13:25:45FromDiscord<enthus1ast> any idea why this complains?I have a proc like so\:`func getComponent(reg: Registry, ent: Entity, ty: typedesc): ty {.inline.} =`Then i have a template, that just omits the `reg``template getComponent(ent: Entity, ty: typedesc): ty =`but it complains like so\:` Error: type mismatch: got 'Health' for 'getComponent(reg, ee, Health_436233388)' but expected 'None'`
13:27:05FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4of1
13:34:59FromDiscord<enthus1ast> oh i got it it must be\:`template getComponent(ent: Entity, ty: typedesc): untyped =`
13:37:23*rockcavera joined #nim
14:38:37PMunchHmm, the Nimble documentations specify that it will auto-detect hg or git from a URL, but when I try to use it it just fails because hg isn't installed
14:38:41PMunchI'm using a github link..
14:44:32*xet7 joined #nim
14:51:47advesperacitI've had that happen as well, can't remember exactly what the problem was
14:53:30advesperacit'requires "https://github.com/<user>/<repo>#HEAD"' is working in one of my projects right now
14:55:43PMunchHmm, nope, can't get it to work
14:55:50PMunchGuess it might be because the repo is private
14:58:31advesperacitI think that was the problem I was having
14:59:13FromDiscord<jtv> You can use github's auth capability to pre-auth to the repo basically
15:00:32PMunchHmm, how is that done?
15:03:15FromDiscord<hotdog> Anyone got a good example of a project that uses the compiler as a library?
15:03:29PMunchnimlsp?
15:04:01PMunchnimscripter as well
15:04:21PMunchGotta go
15:04:22*PMunch quit (Quit: Leaving)
15:05:32FromDiscord<hotdog> Cheers @PMunch good suggestions
15:09:46*xet7 quit (Quit: Leaving)
15:23:03*arkurious joined #nim
15:33:47FromDiscord<jtv> @PMunch install the github command line: https://cli.github.com/ and then just do `gh auth`
16:06:35FromDiscord<matrix07012> How do I setup loggers in one files and export them so that I can use info(), error() everywhere?
16:06:56FromDiscord<matrix07012> How do I setup loggers in one file and export them so that I can use info(), error() everywhere in the projekt?
16:09:11Amun-Rastd/logging
16:14:42FromDiscord<matrix07012> Oh thanks, I thought just importing my logger was enough. I'm dumb
16:18:35FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4og0
16:23:05FromDiscord<Hourglass [She/Her]> Really tempted to try and working on implementing a basic Minecraft server again in Nim
16:25:04FromDiscord<Hourglass [She/Her]> How would I make my code run on multiple threads and distribute the load somewhat evenly?
16:25:51FromDiscord<enthus1ast> @4zv4l\: good question, it looks ok to me (while reading the docs of SetWindowsHookExA)
16:26:09FromDiscord<4zv4l> In reply to @enthus1ast "<@329196212282458112>\: good question, it": to me too 🥺
16:26:28FromDiscord<enthus1ast> can you just try SetWindowsHookEx
16:26:50FromDiscord<enthus1ast> not the ascii version
16:26:58FromDiscord<4zv4l> the same error
16:27:00FromDiscord<4zv4l> 🥺
16:27:03FromDiscord<4zv4l> 87
16:27:34FromDiscord<enthus1ast> mh
16:28:10FromDiscord<enthus1ast> could it be a 32/64 bit issue?
16:28:30FromDiscord<enthus1ast> so the process that you start is this 64 bit?
16:28:30FromDiscord<4zv4l> except that (when I hook all processes it crashes explorer.exe)↵my manager was really impressed how the Nim code was much shorter and simpler than the previous one in C
16:28:37FromDiscord<4zv4l> yep 64 bit
16:28:42FromDiscord<4zv4l> dll too
16:28:46FromDiscord<enthus1ast> k
16:29:40FromDiscord<4zv4l> it's really since I modified the `dwThreadID` before when I just put `0` it was working fine
16:34:31FromDiscord<enthus1ast> the HOOKPROC
16:34:35FromDiscord<enthus1ast> is is https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644981(v=vs.85)
16:34:35FromDiscord<enthus1ast> ?
16:34:41FromDiscord<enthus1ast> GetMsgProc
16:35:49FromDiscord<enthus1ast> ah ok when it was working before
16:44:50FromDiscord<4zv4l> it was working before yes
16:44:59FromDiscord<4zv4l> with `0` as threadID
16:45:06FromDiscord<4zv4l> so the hook was set for all processus
16:49:51FromDiscord<enthus1ast> would be interesting to see what is in pi.dwThreadId and if the thread exists actually
16:50:03FromDiscord<enthus1ast> and if the thread is special in some way who knows
16:51:11FromDiscord<4zv4l> the threadID isn't null at least↵I echoed it and got `26308`
16:51:33FromDiscord<enthus1ast> and does the thread exists?
16:51:44FromDiscord<4zv4l> I'll check that now
16:51:50FromDiscord<enthus1ast> ah and also, the calling convention in the exported dll, is this correctß
16:51:52FromDiscord<enthus1ast> ?
16:52:59FromDiscord<enthus1ast> but i think if it would be incorrect it would just crash, and not warn you i guess
16:53:17FromDiscord<4zv4l> yeah yeah since that was working before for all processes
16:53:23FromDiscord<4zv4l> the function in the dll works
16:53:24FromDiscord<enthus1ast> ok \:)
16:53:33FromDiscord<4zv4l> In reply to @enthus1ast "and does the thread": I can see the PID but idk how to see the thread id
16:53:53FromDiscord<enthus1ast> with proc explorer for example
16:55:49FromDiscord<4zv4l> hmmm either I can't see it or I just don't know how to lol
16:58:02FromDiscord<4zv4l> ok yeah
16:58:27FromDiscord<4zv4l> can see the number https://media.discordapp.net/attachments/371759389889003532/1075823483860299957/image.png
16:58:36FromDiscord<4zv4l> 7048
16:59:27*rez joined #nim
17:03:52FromDiscord<4zv4l> most error I see about 87 with SetWindowHookEx is that they put the processID but I put the ThreadID so it should be fine
17:09:17FromDiscord<Hourglass [She/Her]> Could someone explain to me what a pointer is exactly? I kinda know what they are but I realised that in reality, I don't
17:10:06FromDiscord<Elegantbeef> It's a fancy name for memory address
17:10:59FromDiscord<Hourglass [She/Her]> And ref objects are just wrappers built on pointers?
17:11:06FromDiscord<Hourglass [She/Her]> Wrapping it nicely for Nim to use and stuff?
17:11:58FromDiscord<Elegantbeef> Refs are really just pointers, but with memory managing data allocated before the block
17:12:10FromDiscord<Hourglass [She/Her]> Ah alright then
17:13:07FromDiscord<Coachonko> Bruh
17:18:48*Guest35 quit (Quit: Client closed)
17:19:28FromDiscord<enthus1ast> @4zv4l\: i got it working \:)
17:19:33FromDiscord<enthus1ast> let me make this nice
17:21:51FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4ogj
17:21:55FromDiscord<eyes> i think i just dont get the async programming
17:22:11FromDiscord<Elegantbeef> `os.sleep` sleeps your entire thread
17:24:08FromDiscord<Elegantbeef> Async isnt multi threaded which means that also halts your async logic
17:24:49FromDiscord<enthus1ast> @4zv4l\: the problem is that the application might has not fully started the thread, so stick in a `WaitForSingleObject(pi.hThread, 2_000)` in there
17:24:58FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4ogm
17:25:18FromDiscord<eyes> In reply to @Elegantbeef "`os.sleep` sleeps your entire": i am so dumb
17:25:29FromDiscord<eyes> is sleepAsync what I need in this case?
17:26:17FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4ogo
17:26:42FromDiscord<enthus1ast> or waitForever()?
17:27:27FromDiscord<Elegantbeef> I think they're after a main loop and async loop process
17:28:07FromDiscord<enthus1ast> asyncCheck does not block
17:28:08FromDiscord<Hourglass [She/Her]> Isn't it possible to use async and threading in conjunction with eachother?
17:28:12FromDiscord<enthus1ast> waitFor does
17:28:30FromDiscord<Hourglass [She/Her]> Would it provide any advantages or
17:28:34FromDiscord<Elegantbeef> It is possible to
17:28:47FromDiscord<Hourglass [She/Her]> But a pain I'm assuming?
17:28:52FromDiscord<enthus1ast> it depends on what you want
17:28:55FromDiscord<Elegantbeef> It allows you to use async in a threaded program
17:28:59FromDiscord<Rika> It provides advantages in very specific circumstances
17:29:12FromDiscord<Elegantbeef> It's not a pain cause it's not possible to transfer futures across threads iirc
17:30:59FromDiscord<eyes> I don’t need multiple threads
17:31:22FromDiscord<eyes> i’m just trying to write two loops, both of which sleep and only operate every few seconds, as if they were two threads
17:31:27FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "it depends on what": Planning on writing a Minecraft server software with a somewhat decent layer of abstraction aha
17:31:35FromDiscord<eyes> the library i’m using suggests asyncCheck
17:32:38FromDiscord<Hourglass [She/Her]> And I'm thinking of using threads for certain things, such as a dedicated thread for networking and another for chunk generation.. vetc
17:32:40FromDiscord<Hourglass [She/Her]> Etc
17:32:44FromDiscord<enthus1ast> is the minecraft proto tcp or udp?
17:34:23FromDiscord<enthus1ast> ok tcp
17:35:33FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "is the minecraft proto": Tcp yeah
17:35:34FromDiscord<Hourglass [She/Her]> Why?
17:35:53FromDiscord<Hourglass [She/Her]> Bedrock is udp tho so that'll be fun lmao
17:36:23FromDiscord<enthus1ast> it the minecraft server not also generating the map etc pp?
17:36:23FromDiscord<enthus1ast> thats a huge project, to be honest \:)
17:36:36FromDiscord<enthus1ast> because for udp you do not really need async
17:36:58FromDiscord<enthus1ast> can all happen in one loop then
17:37:08FromDiscord<enthus1ast> you must do your "connection mapping" yourself anyhow
17:39:10FromDiscord<4zv4l> In reply to @enthus1ast "<@329196212282458112>\: the problem is": oh thank you so much !!!!!!!!
17:39:13FromDiscord<4zv4l> works great !
17:39:19FromDiscord<enthus1ast> nice
17:39:42FromDiscord<4zv4l> thank you so so so so much
17:39:42FromDiscord<4zv4l> xD
17:43:06FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "it the minecraft server": That'll be pushed back for a long time lmao
17:43:18FromDiscord<Hourglass [She/Her]> Right now I wanna do something like Minestom, barebones af
17:43:43FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4ogt
17:44:00FromDiscord<Hourglass [She/Her]> I'm making my server software abstract on purpose, it'll be meant to improve upon gradually
17:44:03FromDiscord<enthus1ast> maybe you can start with a minecraft proxy server?
17:44:20FromDiscord<Hourglass [She/Her]> Ideally, once I have a structure for the core working, I can forget about that code and work on plugins haha
17:44:33FromDiscord<enthus1ast> so that you can parse the protocol, step by step
17:45:06FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "maybe you can start": I've already gotten a working server that allows you to join and quit a while ago, which was fun
17:46:00FromDiscord<enthus1ast> and it would be also nice for minecraft hacking
17:47:56FromDiscord<Hourglass [She/Her]> I'll make a crappy mc proxy first then 😎
17:48:10FromDiscord<Hourglass [She/Her]> Though, it'll probably be absolute hell for lower versions hah
17:49:44FromDiscord<Hourglass [She/Her]> I'll need to reimplement the VarInt stuff again ughh
17:51:21FromDiscord<4zv4l> if I use `defer` will it be executed if I use
17:51:26FromDiscord<4zv4l> (edit) "if I use `defer` will it be executed if I use ... " added "`quit` ?"
17:52:20FromDiscord<Hourglass [She/Her]> No, not from what I know
17:52:56FromDiscord<Hourglass [She/Her]> `quit` just exits the program straightaway
17:52:59FromDiscord<Hourglass [She/Her]> Afaik
17:54:58FromDiscord<wiga> am I the only one who's not able to pull nim's docker image?
17:55:50FromDiscord<wiga> wait nvm I think i found the issue
18:05:17FromDiscord<4zv4l> I don't really get how to interact with registry key↵if that's a good way to load a configuration↵is it possible to get an example code on how to get/set a registry key in Nim ?
18:06:22FromDiscord<auxym> personally I'd juste write a config file in $APPDATA instead. Cross platform too, if you use the XDG config dir standard
18:07:03FromDiscord<auxym> any specific reason why you want to use the windows registry?
18:07:30FromDiscord<Hourglass [She/Her]> Now.... Naming
18:07:32FromDiscord<4zv4l> the previous version of the soft was using registry key to save the config
18:07:54FromDiscord<Hourglass [She/Her]> What do I name a Minecraft proxy in Nim?
18:08:01FromDiscord<4zv4l> I'm rewriting it from scratch from C to Nim↵so I can choose how to deal with the config
18:08:16FromDiscord<4zv4l> but they told me they would prefer keeping the registry config if possible
18:14:41FromDiscord<Hourglass [She/Her]> I'm gonna skip the proxy for now :p
18:15:15*rockcavera quit (Remote host closed the connection)
18:16:13FromDiscord<auxym> you'll have to use winim ig and dig a bit into the win32 registry api
18:16:33FromDiscord<auxym> https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry-functions
18:17:04FromDiscord<auxym> look at whatever the C app was doing and find the winim binding for it
18:17:16FromDiscord<auxym> should be pretty much 1:1 translation
18:20:26*jmdaemon joined #nim
18:21:45FromDiscord<sOkam!> Is there any way to force a stack trace, even when things didn't go wrong?
18:25:24FromDiscord<BobBBob> sent a code paste, see https://play.nim-lang.org/#ix=4ogP
18:28:46advesperacittry the writeStackTrace proc https://nim-lang.org/docs/system.html#writeStackTrace
18:44:53FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4ogY
18:48:08FromDiscord<jtv> @sOkam! you can just `echo getStackTrace()` at any point
18:57:10FromDiscord<Hourglass [She/Her]> What's the difference between having my object as a ref object, and doing `T: ref object` in an argument for a proc?
18:57:24FromDiscord<Hourglass [She/Her]> Is there any downsides to doing `ref myObj` or?
19:00:56FromDiscord<Recruit_main707> one means the type is always a reference, the other one means the argument is a reference to that type
19:04:53FromDiscord<Hourglass [She/Her]> Is there any downsides to that approach?
19:05:04FromDiscord<Hourglass [She/Her]> References are always mutable, right?
19:07:25FromDiscord<sOkam!> @jtv ty ✍️
19:08:26FromDiscord<Hourglass [She/Her]> Help I'm doing a Java
19:08:38FromDiscord<Hourglass [She/Her]> `AbstractConnection`
19:08:52FromDiscord<Hourglass [She/Her]> Is there a better name for this? Anything using my API should inherit from it
19:12:42FromDiscord<Nerve> Instead of making a ref object you can pass the object to procs that need it as `var`
19:13:05FromDiscord<Nerve> I believe that means it remains a stack object but additional stack frames can mutate it
19:13:16FromDiscord<Nerve> (edit) "ref" => "`ref`"
19:16:18FromDiscord<enthus1ast> argh i'm fighting with rawProc and rawEnv, only to try devel and there it's working
19:16:34FromDiscord<enthus1ast> BUT, the stuff i'm useing does not work with devel ;\_;
19:17:12FromDiscord<enthus1ast> rawProc and rawEnv for closures is a hack anyhow, but no idea to make it better \:/
19:19:37Zevvwhat are you trying to *do*, actually
19:21:49FromDiscord<Hourglass [She/Her]> In reply to @Nerve "Instead of making a": I think using a ref object would be better here, considering that it's the main server object
19:21:50FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4oh5
19:23:17FromDiscord<enthus1ast> and i can connect multiple procs to same MyObj, they'll be called when the event is triggered
19:23:51FromDiscord<Elegantbeef> Is this a real ECS or just an EC like your previous? 😄
19:23:52FromDiscord<enthus1ast> in my tests all work, but in my application it sigseg
19:23:58FromDiscord<enthus1ast> yes EC
19:24:00FromDiscord<enthus1ast> \:)
19:24:23FromDiscord<enthus1ast> the S is overrated any how
19:25:02FromDiscord<enthus1ast> and i also have troubles to reproduce the issue unfortunately
19:25:08FromDiscord<enthus1ast> because the code above works
19:27:34FromDiscord<enthus1ast> also beef i currently just use the event system from the ec(s)
19:27:56FromDiscord<enthus1ast> argh i hate it when i must fix bugs from past me \: (
19:28:09FromDiscord<Elegantbeef> I was just curious if you were making a true ECS
19:31:30FromDiscord<enthus1ast> the rawEnv does it caputres everything?
19:31:31FromDiscord<enthus1ast> so
19:31:40FromDiscord<carsonfarmer> Hey folks, sorry to just barge in here and ask a question... but just wondering if it is possible to create a generic seq typed by a concept?
19:31:44FromDiscord<enthus1ast> so when there are multiple closures involved?
19:32:49FromDiscord<carsonfarmer> Something like `var blah: seq[MyConcept] = @[ObjOneThatMatchesMyConcept, ObjTwoThatMatchesMyConcept]` (I know that isn't valid syntax)
19:32:59FromDiscord<enthus1ast> @carsonfarmer\: either do Object variants or use ref objects
19:33:15FromDiscord<carsonfarmer> In reply to @enthus1ast "<@499071680841252884>\: either do Object": Ok, this is what I figured! Nice.
19:33:20FromDiscord<Elegantbeef> Nope concepts do not support runtime polymorphism
19:35:04FromDiscord<carsonfarmer> (edit) "figured! Nice." => "figured... rats."
19:36:19FromDiscord<Hourglass [She/Her]> Is it possible to check if a shared library has a method?
19:36:41FromDiscord<Hourglass [She/Her]> Also, can I access variables from a shared library?
19:45:23FromDiscord<Hourglass [She/Her]> Is liberal use of `privateAccess` acceptable for my own library code? I'm splitting it all up because it's getting chunky quite quick, but I don't want to make it public because developers who use my library shouldn't be able to use those APIs
19:45:57*PMunch joined #nim
19:53:20FromDiscord<enthus1ast> when i remove all the other code, around the problem it works \:/
19:53:22FromDiscord<enthus1ast> next project?
19:53:24FromDiscord<enthus1ast> sooo
20:04:18FromDiscord<4zv4l> sent a long message, see http://ix.io/4ohh
20:05:59FromDiscord<Yepoleb> Just tell them to not use certain modules↵(@Hourglass [She/Her])
20:08:15FromDiscord<Saint> https://media.discordapp.net/attachments/371759389889003532/1075871246148964453/image.png
20:08:22FromDiscord<Saint> Shoudl this be import std/httpclient
20:08:23FromDiscord<Saint> In the dogs
20:08:26FromDiscord<Saint> (edit) "dogs" => "docs"
20:09:47FromDiscord<Saint> (edit) "Shoudl" => "Should" | "std/httpclient" => "std/httpclient?"
20:11:25FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4ohk
20:13:48FromDiscord<Hourglass [She/Her]> In reply to @Yepoleb "Just tell them to": I personally think it's just cleaner to structure it like I am
20:21:35FromDiscord<Yepoleb> I don't understand how littering your code with privateaccess is cleaner but you do you
20:28:19FromDiscord<Yandall> When I try to use `await` inside a handler in prologue it doesn't compile. It says that my func is not `gcsafe`. Anyone know how to fix this?
20:29:17FromDiscord<enthus1ast> annotate it with the {.gcsafe.} pragma, but it could be that you must lock access to a shared resource
20:29:39FromDiscord<enthus1ast> imho prologue can use multiple threads
20:31:05*Guest7068 joined #nim
20:33:02FromDiscord<Yandall> In reply to @enthus1ast "annotate it with the": But when I do that I had this warning `Warning: 'getProductListNimAsyncContinue' is not GC-safe as it calls 'nameIterVargensym3' [GcUnsafe2]`. Its ok to ignore that?
20:33:09FromDiscord<Yandall> (edit) "had this" => "getthis"
20:33:12FromDiscord<Yandall> (edit) "getthis" => "get this"
20:35:17FromDiscord<Yepoleb> Are you using windows?
20:35:20FromDiscord<Yandall> Yes
20:35:37FromDiscord<Hourglass [She/Her]> In reply to @Yepoleb "I don't understand how": Tbf I've only used it once in my entire library so maybe it's as bad as I thought
20:36:07*Guest7068 quit (Quit: Client closed)
20:36:23FromDiscord<enthus1ast> this i do not know↵(@Yandall)
20:37:50FromDiscord<Yepoleb> Just try it tbh
20:37:55FromDiscord<Hourglass [She/Her]> Is the nim playground dead again?
20:38:45FromDiscord<Yepoleb> Some parts of asyncdispatch on windows use threads but i don't know which
20:41:56FromDiscord<Yepoleb> The gcsafe warning is there because you might get random memory corruption issues from the threading
20:43:02FromDiscord<Hourglass [She/Her]> How do I make a plugin system if I have to cast to the original plugin and don't know what the original type is
20:43:03FromDiscord<Yandall> In reply to @Yepoleb "The gcsafe warning is": If I compile for linux this issue will dissappear?
20:43:22FromDiscord<Hourglass [She/Her]> (Since I store all the plugin objects as an `AbstractPlugin` in a sequence)
20:44:18FromDiscord<Yepoleb> In reply to @Yandall "If I compile for": Linux uses epoll which does not use threads
20:46:25FromDiscord<Hourglass [She/Her]> Maybe I should just do something like `AbstractPlugin(setup: proc(srv: NbServer) = echo "hello")`
20:46:56FromDiscord<Yepoleb> Don't quote me on anything though, i spent way too much time trying to understand asyncdispatch without much success
20:49:34FromDiscord<sOkam!> In reply to @Hourglass, When the Hour Strikes "Is liberal use of": why don't you export explicitely from a second file that imports the public procs, and you import that file manually yourself?↵thinking of `from bla import nil; export bla.thing`
20:50:48FromDiscord<sOkam!> if you have that file contained in a `private/` or `internal/` folder, it should send the message quite clear that its not meant for external use
20:54:35FromDiscord<Hourglass [She/Her]> Hm I may do that if I need to do more code that accesses private things, but currently it's only one method so
20:54:42FromDiscord<Hourglass [She/Her]> field
20:55:43FromDiscord<sOkam!> imo privateaccess is like unsafe procedures. sure, they are there and usable. but they are never gonna be seen as "good code"
20:56:21FromDiscord<sOkam!> there are certainly cases for them being good, but as a rule i wouldn't say they are a good first option
21:00:46PMunchUgh, getting instantiationInfo is so fickle
21:01:10PMunchI just keep getting where my macro is implemented and not where it is called
21:03:50*derpydoo quit (Quit: derpydoo)
21:13:18FromDiscord<planetis> PMunch are you using instantiationInfo for error message in your macro?
21:13:46PMunchWell, kinda
21:13:51PMunchIt's for a logging thing
21:13:59PMunchBut I figured it out
21:14:17FromDiscord<planetis> how setLineInfo?
21:15:01PMunchHuh?
21:15:10PMunchsetLineInfo is to attach line information to a node
21:15:24PMunchI want to get the location I was called from
21:15:55FromDiscord<planetis> oh ok, didn't know
21:18:34PMunchThe idea with setLineInfo was to add line information to nodes generated e.g. from a template language
21:19:52PMunchOr for example I could add it to protobuf which parses protobuf files and generates code
21:20:22PMunchWith setLineInfo the generated type for a protobuf message could now point to the protobuf file and not the macro code
21:20:53FromDiscord<planetis> oh you wrote it! Awesome
21:21:22PMunchsetLineInfo? Yeah that was my doing :)
21:22:01FromDiscord<Elegantbeef> Isnt instantiation info only set inside a template?
21:22:08FromDiscord<Elegantbeef> So you might need to forward you code through a template
21:22:20FromDiscord<Elegantbeef> Well templates/generics iirc
21:22:24PMunchCorrect
21:22:46PMunchI was creating a template in a macro and calling instantiationInfo from that, but the template was then instantiatied from the macro
21:22:59PMunchSo I had to do it the other way around and wrap the macro call in a template call
21:24:40FromDiscord<Elegantbeef> Would be nice if there was a `macroLineInfo` or something like that, which would store/fetch the instantiation info of the active macro call
21:24:58PMunchThat would indeed be super helpful!
21:31:04FromDiscord<Elegantbeef> Hmm the Macro calling convention could be expanded so a hidden `instantiationInfo` is passed as the first parameter and accessed with `macroInstantionInfo`
21:31:29FromDiscord<Elegantbeef> That seems feasible, but do not know if it'd destroy code 😄
21:32:05FromDiscord<Elegantbeef> In theory it doesnt change anything, it just means that the VM op for a call pops a value off the stack 😄
21:32:55PMunchYeah that shouldn't really do anything bad
21:33:29PMunchBut I don't know how instantiationInfo is actually implemented
21:33:56PMunchSo there might be an easier way of doing it
21:34:44FromDiscord<Elegantbeef> It's a compiler magic
21:35:17FromDiscord<Elegantbeef> Manually handled
21:35:27FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/fc35f83eee55610af3931f95771b6d1bce1fc845/compiler/semmagic.nim#L97-L111
21:39:06*rockcavera joined #nim
22:06:42FromDiscord<BobBBob> sent a code paste, see https://play.nim-lang.org/#ix=4ohO
22:11:12FromDiscord<BobBBob> sent a code paste, see https://play.nim-lang.org/#ix=4ohP
22:11:39FromDiscord<Elegantbeef> `doAssertRaises`
22:13:48FromDiscord<BobBBob> ahhh thank you
22:17:12FromDiscord<tsoj> How do errors manifest themselves when using httpclient (e.g. getContent or newHttpClient), for example when the internet connection fails? Is an exception thrown? In the doc there's only specified that when newHttpClient() is called with a max timeout, it may throw a TimeoutError.
22:17:26FromDiscord<tsoj> as far as I can see at least
22:18:10FromDiscord<Elegantbeef> Click the three dots
22:19:06FromDiscord<Elegantbeef> Uhhh wait, seems multisync procs do not get raises...?
22:24:52FromDiscord<huantian> that's weird, the sync version of the multisync should at least
22:25:11FromDiscord<Elegantbeef> Do they just not raise then?
22:25:25FromDiscord<huantian> I doubt that
22:26:19FromDiscord<Elegantbeef> Oh is the issue they're generic and as such do not show raises...
22:27:37FromDiscord<Elegantbeef> If that's the issue I vote on instantiating constrained generics on declaration
22:27:39FromDiscord<Elegantbeef> It only makes sense
22:48:00*advesperacit quit ()
22:49:40FromDiscord<Yepoleb> In reply to @Hourglass, When the Hour Strikes "Is it possible to": I just saw this again, do you still need help with that?
22:53:00FromDiscord<Yepoleb> The basic idea is to use dynlib and symaddr
22:53:57FromDiscord<Yepoleb> symAddr returns a pointer to either a proc or variable and you need to cast that to the correct type. If it returns nil the name does not exist
22:58:38*PMunch quit (Quit: leaving)
23:06:53FromDiscord<Hourglass [She/Her]> Good to know, thanks!
23:07:27FromDiscord<Hourglass [She/Her]> Does arc play nicely with shared libraries?
23:08:12FromDiscord<Yepoleb> Arc is irrelevant to shared libraries
23:08:25FromDiscord<Yepoleb> You can't pass references to them
23:08:30FromDiscord<Hourglass [She/Her]> Use case: Grab a Plugin object from a shared library, since the plugin object is a free hanging variable
23:08:39FromDiscord<Hourglass [She/Her]> Ah
23:08:57FromDiscord<Hourglass [She/Her]> Wait so I can't pass ref objects to a shared library?
23:09:00FromDiscord<Yepoleb> Oh, if it is a rare nim shared library the answer is more complicated
23:09:07FromDiscord<Hourglass [She/Her]> Ah
23:09:30FromDiscord<Hourglass [She/Her]> The idea is to have the Nim core load Nim shared libraries
23:10:42FromDiscord<Hourglass [She/Her]> Since, it's a plugin system for a reason :p
23:10:55FromDiscord<Yepoleb> https://nim-lang.org/docs/nimc.html#dll-generation
23:11:21FromDiscord<Yepoleb> You need to link the gc as a shared library as well
23:12:56FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4oi7
23:12:57FromDiscord<Hourglass [She/Her]> In reply to @Yepoleb "You need to link": Oh?
23:14:39FromDiscord<Hourglass [She/Her]> I thought arc wasn't a gc
23:15:03FromDiscord<Hourglass [She/Her]> Also no threading support... Sounds painful for when I want to work on speed aha
23:15:54FromDiscord<Yepoleb> It might be completely outdated
23:17:19FromDiscord<Yepoleb> I also work on a minecraft clone sometimes and quickly realized a lot of things are new territory in nim
23:17:38FromDiscord<Yepoleb> So you might have to figure out a lot yourself
23:18:28FromDiscord<Hourglass [She/Her]> Fair enough haha
23:18:46FromDiscord<Hourglass [She/Her]> A client sounds like pain, i despise anything graphical :p
23:20:20FromDiscord<Hourglass [She/Her]> I'm working on a server software which is supposed to be bare bones with plugins doing the heavy lifting (you probably gathered that lol), but I'm breaking it down so networking... The actual blocks, worldgen... Etc is all separate
23:20:22FromDiscord<Yepoleb> Rendering is actually pretty easy as it works the same as in c
23:20:31FromDiscord<Hourglass [She/Her]> I'm not good in C either lol
23:20:55FromDiscord<Yepoleb> What i mean is there is enough documentation
23:21:21FromDiscord<Hourglass [She/Her]> Ah fair
23:21:40FromDiscord<Yepoleb> Threading and memory management is a much harder problem
23:21:58FromDiscord<Yepoleb> Very little documentation on the edge cases of arc
23:22:03FromDiscord<Hourglass [She/Her]> I just think it's horrible in general, feels like a pain to manage a UI, the game, the physics etc
23:22:18FromDiscord<Hourglass [She/Her]> I'm probably overcomplicating it in my head
23:22:40FromDiscord<Hourglass [She/Her]> Oh yeah, does threading work differently with arc at all or?
23:23:14FromDiscord<Yepoleb> You can theoretically share refcounted memory across threads
23:23:40FromDiscord<Yepoleb> But also not really because arc is not threadsafe by default, i had to patch it
23:24:07FromDiscord<Hourglass [She/Her]> That doesn't sound fun at all
23:24:31FromDiscord<Hourglass [She/Her]> Hm, would threading with arc actually be better than refc because of how it works?
23:25:00FromDiscord<Yepoleb> Yes, definitely
23:25:09FromDiscord<Hourglass [She/Her]> Tbf i don't understand how refc works so I can't exactly draw comparisons
23:25:19FromDiscord<Hourglass [She/Her]> I remembered reading about it but I've forgotten
23:25:42FromDiscord<Yepoleb> When i learnt about how bad threading support is i quit nim for a few months lol
23:27:20FromDiscord<Yepoleb> Now i just accept that i can't take anything for granted
23:27:38FromDiscord<Hourglass [She/Her]> In reply to @Yepoleb "When i learnt about": Rip
23:27:54FromDiscord<Hourglass [She/Her]> Yeah tbf nothing will be perfect, just closer to perfect than something else
23:30:56FromDiscord<Yepoleb> I need to go, if you want we can discuss plugins and threading some other time again. Good night!
23:49:52FromDiscord<Hourglass [She/Her]> Goodnight!