<< 13-02-2024 >>

00:22:18*azimut joined #nim
00:30:05FromDiscord<avant_> Who has some more move semantics examples?↵The only source im finding is the talk, `move` and `sink` are quite simple, but I dont get `lent`
00:36:38FromDiscord<Elegantbeef> Lent is a return type borrow that allows you to not copy when directly consumed
00:36:43FromDiscord<Elegantbeef> It's the immutable `var` return type
00:48:40termerI need to figure something out with value types
00:48:44termerI'm in over my head again I think
00:49:15termerif I have a getter proc on a value type, will it copy the value passed into it?
00:49:27termeralso, how do I avoid an object being copied at all
00:49:35termerI recall there was something like overriding =copy and/or =dup
00:49:37termerI forget how though
00:51:20termerWould using var as the arg type avoid copying on those
01:04:42FromDiscord<Elegantbeef> Objects equal or larger than sizeof(float) \ 3 are copied by reference
01:04:46FromDiscord<Elegantbeef> passed by reference\
01:05:04FromDiscord<Elegantbeef> You can make `proc =dup(_: MyType): MyType {.error.}`
01:06:16FromDiscord<Elegantbeef> You can also explicitly annotate `byref` but if you want no copies disable copy and dup
01:11:21termerbigger than float are passed by reference?
01:11:30FromDiscord<Elegantbeef> \3
01:12:49termerdivided by 3?
01:12:51termerwhqat
01:12:52termer*what
01:13:08FromDiscord<Elegantbeef> irc moment
01:13:13FromDiscord<Elegantbeef> bigger than three floats
01:13:42FromDiscord<Elegantbeef> Basically do not worry about passing by value vs. reference Nim does the 'right' thing
01:19:47FromDiscord<Elegantbeef> @Robyn [She/Her] is there a reason you constrained to nimcall?
01:23:57*jmdaemon joined #nim
01:25:53FromDiscord<girvo> Is the reason why `asyncnet` (and similar -- including chronos from what I can see) don't define timeouts as parameters to the various socket functions is that one can apply a timeout to any given future anyway? Trying to understand if I'm missing something obvious -- `std/net`'s various socket fuctions (`recv` et al) do support timeouts, but asyncnet doesn't (and as far as I can tell the same is true for chronos)
01:26:38FromDiscord<Elegantbeef> I assume the idea is that you do not need to worry about timeout as blocking is a non issue
01:27:12termerasyncnet sucks is why
01:27:53FromDiscord<girvo> In reply to @Elegantbeef "I assume the idea": I mean... doesn't that mean that it can remain blocked forever and never clean up whatever it's got setup in that context?
01:28:23FromDiscord<girvo> In reply to @termer "asyncnet sucks is why": Oh definitely lol, hence the reference to chronos too, but I see they only define timeouts as params at the higher level HTTP interface
01:28:38FromDiscord<girvo> or rather, httpclient
01:29:27FromDiscord<girvo> And httpclient just `.wait(duration)`'s the Future
01:30:48termerI think chronos does have a timeout thing
01:30:54termerit's just built into Future since they can be canceled
01:30:58FromDiscord<girvo> In reply to @Elegantbeef "I assume the idea": and not that it matters as we're not using async in this context, but in FreeRTOS we really have to have timeouts to unblock tasks eventually due to the real time requirements
01:30:59termertheir system is more sophisticated
01:31:09FromDiscord<girvo> In reply to @termer "it's just built into": yeah that's `wait()`
01:31:21FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=UuhQtKFugRHa
01:31:40FromDiscord<girvo> Which makes sense I think, just wanted to make sure I wasn't missing something obvious lol
01:34:20FromDiscord<girvo> btw I did end up splitting all the "main threads" out into their own processes, and wrapped it up in a systemd `PartOf=` service set 🙂 benefits of treating it like its a single service, but they're built from 5 binaries. Its quite nice
01:37:44*Batzy_ joined #nim
01:40:12FromDiscord<Elegantbeef> Nice
01:40:27*Batzy quit (Ping timeout: 264 seconds)
01:40:51FromDiscord<Elegantbeef> Do you have a nice nimscript task of deploy? 😄
01:50:13FromDiscord<girvo> In reply to @Elegantbeef "Do you have a": Not yet, but thats the next task 😄
01:50:18FromDiscord<girvo> to be executed by CircleCI haha
01:50:30FromDiscord<girvo> Btw its frustrating that https://github.com/status-im/nim-chronos/tree/master/docs/examples/tcpserver.nim is linked in their docs but doesn't exist 😭
01:51:13FromDiscord<girvo> Its not in v3.2.0 or v4.0.0 or master
01:52:55FromDiscord<girvo> I was hoping I could easily move to it from asyncnet, but I've had to change a lot as it uses `AsyncFD` instead of `AsyncSocket` and so on, from what I can tell
01:53:29FromDiscord<girvo> Oh! I found an example at least: https://github.com/status-im/nim-chronos/pull/478/files
01:56:39FromDiscord<girvo> I _really_ want to use Chronos instead of asyncnet here, but for raw TCP/IP code it seems very undocumented sadly
02:00:17FromDiscord<girvo> I guess my best bet is just to go through apps/httpclient
02:01:16FromDiscord<girvo> Or rather, httpserver
02:21:39FromDiscord<sent44> sent a long message, see https://pasty.ee/ZWlhBMxltGQj
02:50:26*zdl joined #nim
03:17:19zdlhi, i was trying the progress reporting code sample from https://nim-lang.org/docs/httpclient.html and tried modifying it a little bit by adding a sequence called speeds in the global scope(var speeds = newSeq[int](10)) and then trying to add a value to it in the onProgressChanged function(speeds.add(speed)), but if i do this an error appears in the console that says "type mismatch: got 'proc (total: BiggestInt, progress: BiggestInt, speed
03:17:19zdl: BiggestInt): Future[system.void]' for 'onProgressChanged' but expected 'ProgressChangedProc[Future[system.void]]". this only happens when adding a value to a sequence, it does not happen if i edit a normal array or if the speeds sequence is created in the onProgressChanged. why does this happen? i posted the code in https://0x0.st/Hdts.nim if anyone wants to see
03:17:54FromDiscord<Elegantbeef> `int` != `BiggestInt`
03:17:59FromDiscord<Elegantbeef> Convert the one to the other
03:20:32*derpydoo quit (Ping timeout: 268 seconds)
03:23:29zdlthat doesn't fix the problem, the error appears even if i add a static value to the sequence, like speeds.add(3)
03:35:43FromDiscord<Elegantbeef> Ah it's a gcsafeness issue
03:35:56FromDiscord<Elegantbeef> `{.cast(gcSafe).}: mySeq.add ...` solves it
03:36:02FromDiscord<Elegantbeef> Ugly as sin though
03:52:50zdlyep, that fixes the problem
03:52:53zdlthanks!
03:53:30*zdl quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
04:24:29*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
04:30:50FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=zWHBmfAYaiIg
04:34:17FromDiscord<Elegantbeef> What's the issue?
04:35:33FromDiscord<madonuko> > it's stuck
04:35:42FromDiscord<madonuko> at the last line
04:35:51FromDiscord<Elegantbeef> Ah sorry I just read the output
04:36:09FromDiscord<madonuko> oh lol, take your time
04:36:47FromDiscord<Elegantbeef> Why are you doing `mold -run`?
04:37:18FromDiscord<madonuko> it usually makes builds slightly faster
04:37:40FromDiscord<madonuko> I don't think that'd be an issue though, right…?
04:37:50FromDiscord<Elegantbeef> I mean mold would if you used the linker
04:38:21FromDiscord<madonuko> I built the entire nim compiler using mold and it went fine
04:38:23FromDiscord<Elegantbeef> No clue could be an conflict
04:38:54FromDiscord<madonuko> hmm ok
04:39:16FromDiscord<madonuko> what does the git fatal message mean though
04:39:16FromDiscord<Elegantbeef> Though ime `mold` does not help in Nim compilation much
04:39:49FromDiscord<madonuko> I see
04:39:50FromDiscord<Elegantbeef> What fatal, I'm blind
04:40:38FromDiscord<madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=TTzqVUlgWbDu
04:41:02FromDiscord<madonuko> it tried to build… nimble? and then git didn't work…?
04:41:45FromDiscord<madonuko> fatal: not a git repository
04:41:50FromDiscord<madonuko> I've no idea where this comes from
04:42:09FromDiscord<madonuko> I'
04:42:31FromDiscord<madonuko> I've just tried without mold, same issue, so probably… some really weird bugs
04:44:23FromDiscord<leorize> it's fine, nimble binary runs git to get the hash to embed into the binary
04:44:35FromDiscord<leorize> but nothing will break if that couldn't happen
04:44:54FromDiscord<Elegantbeef> Yea that fatal is not in the build log so it can sorta be ignored
04:45:32FromDiscord<madonuko> ah… but I mean I cloned the repo with git so I'm a bit confused
04:45:50FromDiscord<madonuko> but guess that's not the issue
04:46:39FromDiscord<leorize> if the build hangs then you probably should do it by hand
04:48:08FromDiscord<leorize> run `nimble setup` in choosenim directory and you can run `nim c src/choosenim` which should show some more details
04:48:35FromDiscord<madonuko> ok let me try
04:54:31FromDiscord<madonuko> so somehow that worked
04:55:46FromDiscord<madonuko> I tried nimble --verbose and turns out it really just gets stuck here doing nothing https://media.discordapp.net/attachments/371759389889003532/1206826020573945866/image.png?ex=65dd6b51&is=65caf651&hm=22e66ace991d1619802a354d94e8a020d5e1e8b74f1a2ac50ad1a3e20753f001&
04:56:02FromDiscord<madonuko> when I mean nothing I do mean absolutely nothing https://media.discordapp.net/attachments/371759389889003532/1206826089381625916/image.png?ex=65dd6b61&is=65caf661&hm=ebf3baffefe3aa4a7f1f3f33ba8e4de73436956407ec1156ecb258271a382e4d&
04:56:25FromDiscord<madonuko> using `nim c` works perfectly though
04:56:45FromDiscord<madonuko> maybe a bug report…?
05:07:36*SchweinDeBurg joined #nim
05:30:20*azimut quit (Ping timeout: 255 seconds)
05:55:46FromDiscord<morgan> so i profiled my code (most relevant the convolver in it), and it looks like the worst offender in it is something in arraymancer
05:56:02FromDiscord<morgan> i realized it was probably something like that before i profiled it
05:56:22FromDiscord<morgan> when i converted the convolution to use avx2 simd and saw little change in performance
05:56:31FromDiscord<morgan> so i need to optimize the memory access
05:57:03FromDiscord<morgan> im using at ContiguousIndex for 1D indexing
05:57:16FromDiscord<morgan> and i need 8 values at a time
05:58:50FromDiscord<morgan> oh and i tried release build mode
05:58:59FromDiscord<morgan> i didn't try danger, maybe that would help
06:03:02FromDiscord<morgan> doesn't look like it did anything
06:08:22FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "<@524288464422830095> is there a": Didn't realise I could use a different calling convention aha
06:09:27FromDiscord<Elegantbeef> closure would probably be ideal so you can capture data
06:11:23FromDiscord<Robyn [She/Her]> Fair
06:11:32FromDiscord<Robyn [She/Her]> I might tinker around with it later then
06:11:47FromDiscord<Robyn [She/Her]> I only did it like this because it's Good Enough™️ for my usecase
06:33:17FromDiscord<girvo> Anyone know how to read a file in an async manner with chronos? The whole TCP server stuff is working nicely, but I have blocking filesystem `readFile()` calls in there currently still. I can't seem to find much about it.↵↵Can I just use `asyncfile` but with `chronos` instead of `asyncdispatch`?
06:36:48FromDiscord<girvo> sent a long message, see https://pasty.ee/EhcmpMhDvSJS
06:37:11FromDiscord<intellij_gamer> Issue is how choosenim builds the `proxyexe`, basically nimble is stuck waiting for input iirc.↵You can change this section here to add "-y" to the nimble command https://github.com/dom96/choosenim/blob/master/src%2Fchoosenimpkg%2Fswitcher.nim#L11
06:38:25FromDiscord<intellij_gamer> ( @madonuko )
06:41:52*advesperacit joined #nim
06:42:08FromDiscord<madonuko> alright
06:58:24FromDiscord<morgan> i think im gonna try using `ptr`
06:58:38FromDiscord<morgan> i think there's a way to load from a pointer
06:58:55FromDiscord<morgan> so hopefully i can get that working with offsets
06:59:05FromDiscord<morgan> (edit) "i think there's a way to load ... from" added "to simd"
06:59:48*PMunch joined #nim
07:25:59*disso-peach joined #nim
08:04:42FromDiscord<morgan> holy shit that's so much faster, tho uh, doesn't look like it's working correctly lol
08:08:47*azimut joined #nim
08:18:27FromDiscord<morgan> well it works when i don't use the pointer load function, and seems of comparable speed
08:45:10*disso-peach quit (Quit: Leaving)
08:56:46*jmdaemon quit (Ping timeout: 256 seconds)
09:34:35Amun-Rahmm, what's the easiest way to get the name of a variable as string in compiletime?
09:34:45FromDiscord<Elegantbeef> `astToStr`
09:35:18Amun-Rathanks
09:38:08FromDiscord<Elegantbeef> Oh @Robyn [She/Her] I was thinking about it and I do have a hack if you want it for JS support 😄
09:38:35FromDiscord<Elegantbeef> Well for type information atleast
09:39:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=IkDJiHYobvYz
09:43:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=RZnMFZpMdAFX
09:44:14FromDiscord<Elegantbeef> Since JS does not have arity that should just work
09:46:05Amun-RaElegantbeef: astToStr doesn't exactly work as I expected: https://play.nim-lang.org/
09:46:07Amun-Raargh
09:46:13Amun-Rahttps://play.nim-lang.org/#pasty=fgCMErwpaHWn
09:46:32FromDiscord<Elegantbeef> const's arent vars
09:46:38Amun-Raright
09:47:01Amun-Rais there any way I could get "Foo"?
09:47:08FromDiscord<Elegantbeef> `macro stringify(s: untyped): untyped = newLit(s)`
09:47:13FromDiscord<Elegantbeef> But it's untyped so `Foop` works
09:47:45FromDiscord<Elegantbeef> This is a common nuisance with consts
09:53:59Amun-Raeverytime I go back to writing macros after some time I feel like I'm starting from scratch ;)
09:58:55FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Dispatching might work with": Huh... I mean, I could definitely try it
09:59:14Amun-Rahttps://play.nim-lang.org/#pasty=CsbXNNoSichj
10:01:42FromDiscord<Elegantbeef> I mean you're using a template
10:01:50FromDiscord<Elegantbeef> Templates are code subsitutions, not macros
10:04:35FromDiscord<Robyn [She/Her]> I'm assuming asyncdispatch doesn't work with JS?
10:04:46Amun-RanewLit returns NimNode, strVal should return string, yet an error pops up: https://play.nim-lang.org/#pasty=YUFaOmWayAQz
10:05:10FromDiscord<Elegantbeef> `s.newLit` returns a `newLit(NimNode)`
10:05:27FromDiscord<Elegantbeef> That NimNode literal does not have a strval
10:05:52Amun-Raah, so it returns string only if there a string value assigned
10:06:03FromDiscord<Elegantbeef> You also are attempting to return a string in a macro
10:06:08FromDiscord<Elegantbeef> You can only return nimnodes in macros
10:06:16FromDiscord<Elegantbeef> So stop using types on a macro's return value
10:06:23FromDiscord<Elegantbeef> use `untyped` if it can be an expression
10:07:28Amun-RaI remember I had to use macro+template pair a few times before
10:08:24Amun-RaError: request to generate code for .compileTime proc: $; I'll leave it for later… ;)
10:10:57FromDiscord<Elegantbeef> Yea just use my macro and stop hurting yourself
10:11:21FromDiscord<Elegantbeef> Whoops that was `newLit(s.repr)`
10:11:28FromDiscord<Elegantbeef> Oopsie
10:11:34Amun-Rahmm
10:11:59FromDiscord<Elegantbeef> `macro stringify(s: untyped): untyped = newLit(s.repr)` will stringify any untyped expression
10:12:41Amun-Rabut that'll stringify the value and not the label
10:13:11Amun-Rawait there's difference between stingify(Foo) and Foo.stringify
10:13:27Amun-Rafirst one returns label, second one value
10:14:12Amun-Rahttps://play.nim-lang.org/#pasty=wakiljIdTIjI
10:14:17Amun-RaI got used to that syntax
10:15:18FromDiscord<Elegantbeef> Yes method call forces semantic analysis
10:15:53FromDiscord<Elegantbeef> Think about it to know what to call `x` in `x.y` must be analysed before `y`
10:16:18Amun-Raah
10:16:28Amun-Ramakes sense, thanks
10:42:36FromDiscord<mratsim> In reply to @morganalyssa "i think there's a": https://github.com/mratsim/laser/blob/master/laser/simd.nim#L50-L51
10:48:30FromDiscord<intellij_gamer> In reply to @chronos.vitaqua "I'm assuming asyncdispatch doesn't": You can use [std/asyncjs](https://nim-lang.org/docs/asyncjs.html) if you want to use async code tho
10:50:47FromDiscord<mratsim> sent a long message, see https://pasty.ee/fNSQWugkpfPN
10:52:00FromDiscord<mratsim> `omp simd` can be done in Nim with this: https://github.com/mratsim/Arraymancer/blob/master/src/arraymancer/nn_primitives/fallback/conv.nim#L38
10:57:35FromDiscord<kiloneie> Made a new Nim tutorial video: https://youtu.be/VSnFw5X2Rp4↵↵You may share your feedback on the forum thread: https://forum.nim-lang.org/t/8552
11:29:48FromDiscord<Robyn [She/Her]> In reply to @intellij_gamer "You can use [std/asyncjs](https://nim-lang.org/docs": Thanks! Don't need to support it though so it's fine
12:29:58*xet7 quit (Remote host closed the connection)
13:36:55*ntat joined #nim
13:37:37*ntat quit (Quit: Leaving)
13:37:59*ntat joined #nim
14:02:35*xet7 joined #nim
15:09:00*baalajimaestro joined #nim
15:15:52*redj quit (Ping timeout: 268 seconds)
16:25:10*ox is now known as oz
17:04:31*PMunch quit (Quit: Leaving)
17:12:55*Guest3 joined #nim
17:13:56*Guest3 quit (Client Quit)
17:21:05NimEventerNew thread by undefined: Reasoning behind function call syntax in Nim., see https://forum.nim-lang.org/t/10986
17:24:57*azimut quit (Remote host closed the connection)
17:25:40*azimut joined #nim
17:28:17*Guest73 joined #nim
17:43:48*Guest73 quit (Quit: Client closed)
17:56:46*krux02 joined #nim
17:56:52FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Dispatching might work with": Modified my code to have something similar to this (the emit statement is the exact same), but Nim complains with `Unhandled exception: handler_536872334[handler_536872334_Idx] is not a function [<foreign exception>]`
18:19:10FromDiscord<morgan> In reply to @mratsim "https://github.com/mratsim/laser/blob/master/laser/": yeah i was using the avx version of those
18:19:33*rockcavera quit (Ping timeout: 256 seconds)
18:20:08FromDiscord<morgan> In reply to @mratsim "are you using the": and i wrote my own convolution, because i needed something custom
18:21:10FromDiscord<morgan> its a loop over every pixel and within that, a loop over every pixel in a centered subset that is set from the input image
18:21:30FromDiscord<morgan> single channel, unlimited kernel size
18:23:34FromDiscord<morgan> and i’m not sure that it’s separable, the shape of a normalized 1d slice of it changes as it’s moved in the other axis
18:23:41FromDiscord<morgan> @mratsim
18:24:21*rockcavera joined #nim
18:24:21*rockcavera quit (Changing host)
18:24:21*rockcavera joined #nim
18:25:48FromDiscord<morgan> it’s for prerendering a texture that emulates glow pretty realistically imo, with the advantage that scaling the apparent brightness is simply a multiplication, before a soft clip and gradient map
18:28:59FromDiscord<morgan> now that it’s so much faster i might actually render out even larger versions
18:33:06FromDiscord<morgan> not sure whether i want to make them multi-resolution (more quads to render) or have separate versions
18:34:19FromDiscord<morgan> tho i should test it out and see if the borders are noticeable at any brightness not comparable to staring at the sun
18:42:20*derpydoo joined #nim
20:08:41*Jjp137 quit (Quit: Leaving)
20:10:50*Jjp137 joined #nim
20:38:33FromDiscord<MDuardo> I have a doubtIf Nim relies in a C compiler to generate C code... How the Nim version distributed by NixOS can compile as normal?
20:38:45FromDiscord<MDuardo> I don't have GCC or Clang
20:40:05FromDiscord<nnsee> if you can compile binaries, you definitely have either gcc or clang
20:40:26FromDiscord<nnsee> i suspect you'll have to inspect the nix recipe as the ultimate source of truth
20:41:34FromDiscord<odexine> installing nim on nixos gives you gcc, but it doesnt expose it outside of nim
20:41:47FromDiscord<odexine> because thats kinda how nix(os) works
20:49:36FromDiscord<leorize> nixpkgs have dependencies coded into programs directly
20:49:38FromDiscord<leorize> so gcc might not be in path but it's in nix store and nixpkgs' nim would be configured to use it
20:53:33FromDiscord<huantian> to be more specific, the `nim` and `nim2` derivations are wrappers around `nim(2)-unwrapped`
20:54:05FromDiscord<huantian> in these wrappers, they have a `config.nims` that tells `nim` to use `$CC` and `$CXX` to find the compilier https://github.com/NixOS/nixpkgs/blob/621c9a4f91bde0457e56e6abf796254f981a27f5/pkgs/development/compilers/nim/default.nix#L208-L213
20:54:48FromDiscord<MDuardo> Thank you very much, I will look into it to understand it better
20:55:01FromDiscord<sirius_3x> sent a long message, see https://pasty.ee/PMpYrLnWZuoN
20:55:12FromDiscord<sirius_3x> sry forgot formatting
20:55:25FromDiscord<sirius_3x> (edit) "long message," => "code paste," | "https://pasty.ee/BzdKtnbmASCO" => "https://play.nim-lang.org/#pasty=PFSGVFkKaTkd"
20:57:29FromDiscord<sirius_3x> nvm, round brackets worked
20:57:44FromDiscord<sirius_3x> does it become a tuple then tho?
20:58:38FromDiscord<huantian> yes
20:58:58FromDiscord<sirius_3x> In reply to @huantian "yes": ty
20:59:23FromDiscord<huantian> i'd ask why nested arrays wouldn't be a good option for you
21:02:18FromDiscord<odexine> i would ask as well
21:02:18FromDiscord<sirius_3x> i want the algorithm to be well readable and easy to understand. i feel like it is easier for ppl to visualize some operations on this matrix better this way. at least for me it is
21:03:31FromDiscord<sirius_3x> sure if youre used to math coding, you would see the dimensions and go "yea ok, i know what hes doing here"↵but if you are new, i think it's not as obvious
21:04:08FromDiscord<huantian> the issue is that they mean different things
21:04:25FromDiscord<huantian> the idea of tuples is that the elements may not all be the same type
21:04:39FromDiscord<huantian> whereas in a matrix you know that all the rows should have the same element type, same number of columns
21:04:57FromDiscord<huantian> if it's an issue in terms of reading, then perhaps you can just add a comment
21:04:59FromDiscord<sirius_3x> does that create additional overhead for this type though?
21:05:25FromDiscord<sirius_3x> like, does the tuple take up more space ?
21:05:34FromDiscord<odexine> it creates different semantics and behaviour
21:05:42FromDiscord<odexine> you will program differently between the two versions
21:05:53FromDiscord<odexine> there are heavier limitations when using tuples
21:06:01FromDiscord<odexine> (in the use case of a matrix)
21:06:56FromDiscord<sirius_3x> sry for asking, but what kind of limitations would that be?
21:07:34FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#pasty=qHqjPDcdBsjx
21:07:35FromDiscord<huantian> consider this code
21:07:39FromDiscord<sirius_3x> ay
21:08:19FromDiscord<sirius_3x> though i dont know what .low and .high mean tbh, sry
21:08:28FromDiscord<huantian> the corresponding code doesn't compile for tuples:
21:08:32FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#pasty=JAPEODtKhtVh
21:08:50FromDiscord<sirius_3x> you cant reference entries by [i][j] ?
21:09:12FromDiscord<huantian> you can only index tuples by `[i]` if `i` is known at compile time
21:09:21FromDiscord<sirius_3x> oh thats sad
21:10:32FromDiscord<sirius_3x> thank you for the example!↵so then i will have to just do a nested array? no workarounds?
21:10:52FromDiscord<odexine> yes
21:11:16FromDiscord<sirius_3x> alrighty, ty both! very helpful
21:11:42FromDiscord<huantian> In reply to @sirius_3x "though i dont know": btw low and high are the first and last index of an array or seq
21:12:26FromDiscord<sirius_3x> oh ok, so high is equal to just using .len?
21:12:37FromDiscord<sirius_3x> on the array i mean
21:12:57FromDiscord<sirius_3x> (edit) "high" => ".high"
21:13:05FromDiscord<odexine> no
21:13:10FromDiscord<odexine> high is like len-1
21:13:24FromDiscord<odexine> ...but not necessarily, but that's a more advanced topic
21:13:27FromDiscord<sirius_3x> ahhh
21:20:06*xet7 quit (Remote host closed the connection)
21:21:23FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=AYDrsBNxSUej
21:21:31FromDiscord<Robyn [She/Her]> Orc should work with that code, right?
21:24:15FromDiscord<nasuray> In reply to @MDuardo "Thank you very much,": The config.nims tells nim but the `makeWrapper` https://github.com/NixOS/nixpkgs/blob/621c9a4f91bde0457e56e6abf796254f981a27f5/pkgs/development/compilers/nim/default.nix#L285-L289 creates a shell script which sets those values. On my current system it is this https://pasty.ee/xIvBDWOKvyLT
21:30:01FromDiscord<Robyn [She/Her]> Hey Beef, can `{.nimcall.}`s function as a `{.closure.}` if I cast it?
21:36:29FromDiscord<leorize> no
21:36:36FromDiscord<odexine> darn beat to the punch\
21:36:43FromDiscord<leorize> but you can just assign it directly
21:36:58FromDiscord<leorize> and nim will generate a wrapper for you
21:36:58FromDiscord<Robyn [She/Her]> Wdym by assigning it directly?
21:37:17FromDiscord<leorize> basically just use it in context where you need a closure
21:37:30FromDiscord<Robyn [She/Her]> Oh okay! Thanks!
21:39:17FromDiscord<Robyn [She/Her]> Ah it now needs to be annotated as GC safe
21:39:18FromDiscord<Robyn [She/Her]> Makes senze
21:39:20FromDiscord<Robyn [She/Her]> Sense
21:40:12FromDiscord<Robyn [She/Her]> Nvm that wasn't the issue
21:42:58FromDiscord<Robyn [She/Her]> It'd probably be easier to just accept a `nimcall` oof-
21:43:25*ntat quit (Quit: Leaving)
21:43:46FromDiscord<leorize> maybe you can post the error message here
21:43:54FromDiscord<leorize> and we can see what's the jig
21:44:16FromDiscord<Robyn [She/Her]> I'll put the code on the playground after trimming it ehe
21:48:41FromDiscord<Robyn [She/Her]> Ah well now I'm getting a different error-
21:51:40FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=QvvyygPOXYna
21:56:49FromDiscord<odexine> `proc (a: A, b: A){.gcsafe.}` probably doesnt match `ListenerProcs[T, R]`
21:58:26FromDiscord<Robyn [She/Her]> But I don't wanna force a type to be gcsafe :p
21:58:32*azimut quit (Ping timeout: 255 seconds)
21:59:23FromDiscord<Robyn [She/Her]> Should I do `ListenerProc[T, R] = proc(o: T, p: R) {.closure.} | proc(o: T, p: R) {.closure, gcsafe.}` or something?
22:00:00FromDiscord<Robyn [She/Her]> That was not a solution, type mismatch still exists
22:02:56FromDiscord<Robyn [She/Her]> Eh, not that much of an issue for me, I can live without it being a closure
22:24:11FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=AtSUrEkksQts
22:35:08FromDiscord<Robyn [She/Her]> Ughh... Beef may actually make me use traitor-
22:36:14FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=iLnmQpobkFZH
22:37:36FromDiscord<Robyn [She/Her]> Test time
22:38:21FromDiscord<Robyn [She/Her]> Yep oof
22:38:41FromDiscord<Robyn [She/Her]> Unless I just make a macro for `write` and `read` so it can use the defined fields
22:41:40FromDiscord<odexine> the field names of a tuple have no bearing on type matching iirc
22:43:05FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "Unless I just make": Hmm... How to get the type of a field-
22:43:11FromDiscord<Robyn [She/Her]> In reply to @odexine "the field names of": Fair enough
22:43:21FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "Hmm... How to get": Type of a field from a string
22:43:56FromDiscord<girvo> In reply to @chronos.vitaqua "Yep oof": yeah thats the whole raison d'être for using tuples vs objects as far as I can tell. structural matching
22:44:27FromDiscord<Robyn [She/Her]> In reply to @girvo "yeah thats the whole": Makes sense
22:44:36FromDiscord<Robyn [She/Her]> I don't want structural matching here so, 🤷‍♀️
22:44:43FromDiscord<odexine> In reply to @chronos.vitaqua "Type of a field": ...?
22:45:49FromDiscord<girvo> In reply to @chronos.vitaqua "I don't want structural": does an `object` not fit?
22:46:45FromDiscord<Robyn [She/Her]> In reply to @girvo "does an `object` not": It does yeah
22:46:50FromDiscord<Robyn [She/Her]> Just wanna make a generic for it
22:48:51FromDiscord<Robyn [She/Her]> In reply to @odexine "...?": I figured that out
22:49:10*advesperacit quit ()
22:49:40FromDiscord<Robyn [She/Her]> I need to figure out how to set a field's value with the field's name as a string
22:50:26FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=iHyaFWgjQluS
22:50:29FromDiscord<Robyn [She/Her]> Something like that
22:51:59FromDiscord<Elegantbeef> ooooooh noooooooo↵(@Robyn [She/Her])
22:54:00FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "ooooooh noooooooo (<@524288464422830095>)": I avoided your grasp for now :P
22:54:15FromDiscord<Robyn [She/Her]> Hoping to be able to do this without any dynamic dispatch
22:54:21FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=iVwewNLKFKVc
22:55:47FromDiscord<Elegantbeef> A fields loop + when is so hard
22:56:17FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=MMrScwhIausM
22:56:25FromDiscord<odexine> yyyyyyyes
22:56:28FromDiscord<Robyn [She/Her]> Like, is it unneccessary to have it?
22:56:29FromDiscord<Robyn [She/Her]> Ah
22:56:33FromDiscord<Elegantbeef> Yes
22:56:34FromDiscord<odexine> see what beef said
22:56:49FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "A fields loop +": I don't know the specific packet's fields
22:56:57FromDiscord<odexine> well you dont need to?
22:57:06FromDiscord<Robyn [She/Her]> I don't get what you mean then?
22:57:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=HCXVgTohJedj
22:57:18FromDiscord<odexine> for name, field in x.fieldpairs: when name == thestring: field = thevalue
22:57:23FromDiscord<odexine> ok
22:57:27FromDiscord<odexine> ok beef ok
22:57:38FromDiscord<Elegantbeef> Rika this aint no foot race
22:57:52FromDiscord<odexine> my excuse is that i havent slept in how many hours
22:57:57FromDiscord<girvo> chronos makes nimsuggest die quite spectacularly lol
22:58:08FromDiscord<odexine> what doesnt make nimsuggest die quite spectacularly
22:58:30FromDiscord<girvo> In reply to @odexine "what doesnt make nimsuggest": hey I'd managed to keep our code at work simple enough at this point such that it was acutally okay lol
22:58:42FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=fwQtBYQPNjcG
22:59:09FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=oKOfrdefSPjP
22:59:24FromDiscord<Elegantbeef> Why template?
22:59:36FromDiscord<Elegantbeef> I swear people just write shit code to spite me
23:00:13FromDiscord<Robyn [She/Her]> I was gonna change it to a proc after seeing your code :p
23:04:13FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I swear people just": Also, I do :D
23:04:30FromDiscord<Robyn [She/Her]> I hope my event library wasn't that bad th
23:08:08FromDiscord<Elegantbeef> Why were you even considering traitor?
23:09:16FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Why were you even": I have no idea honestly
23:09:27FromDiscord<Robyn [She/Her]> Didn't even need it nor do I think it'd help
23:09:28FromDiscord<Elegantbeef> PS traitor does not force runtime dispatch
23:09:31FromDiscord<Elegantbeef> It enables it
23:09:39FromDiscord<Elegantbeef> But you can use it fully with static dispatch
23:10:29FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=uOGvPsgsMCKv
23:10:45FromDiscord<Elegantbeef> `converter` yes it is
23:10:49FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It enables it": Ooooh nice! No disadvantage then!
23:11:16FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "`converter` yes it is": Why is it a bad idea? I know `converter`s are generally bad but I can't see why this would be bad
23:11:31FromDiscord<Elegantbeef> Converters explode in your face 9/10times
23:11:41FromDiscord<Elegantbeef> But that aside what does `VarNum` even mean
23:12:08FromDiscord<Robyn [She/Her]> It's a type specific to the network stuff, hold on
23:12:23FromDiscord<Elegantbeef> Is it a variable length integer?
23:12:34FromDiscord<Robyn [She/Her]> https://wiki.vg/Protocol#Definitions:varint & https://wiki.vg/Protocol#Definitions:varlong
23:12:40FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Is it a variable": Yep-
23:12:43FromDiscord<Robyn [She/Her]> (edit) "Yep-" => "Yep!"
23:12:56FromDiscord<Elegantbeef> Believe it or not you can do `VariableLength[T:]`
23:13:17FromDiscord<Robyn [She/Her]> `VariableLength[T:]`?
23:13:29FromDiscord<Elegantbeef> Or if you want to be more concise `Variable[T:...]`
23:13:39FromDiscord<Elegantbeef> Instead of `VarNum` which is a silly name 😛
23:13:57FromDiscord<Robyn [She/Her]> VarNum makes sense to me because I'm reading from the docs :p
23:14:23FromDiscord<Elegantbeef> But it seems fine
23:14:27FromDiscord<Robyn [She/Her]> I'm gonna hope the converter doesn't blow up in my face :P
23:14:31FromDiscord<Elegantbeef> PS you can quit being so silly
23:14:37FromDiscord<Robyn [She/Her]> Oh sorry
23:14:47FromDiscord<Robyn [She/Her]> I got into the habit of doing that everywhere again
23:14:50FromDiscord<Elegantbeef> `converter toVarNum[T: uint32 or uint64](var: T): VarNum[T] = VarNum[T](var)`
23:15:46FromDiscord<Robyn [She/Her]> That's cleaner
23:15:52FromDiscord<Robyn [She/Her]> My brain is chronically exhausted
23:17:16FromDiscord<Elegantbeef> Stop drinking monsters
23:17:28FromDiscord<Robyn [She/Her]> I haven't drank one in a week now
23:17:39FromDiscord<Robyn [She/Her]> Also they make me calmer and sleep better :p
23:17:51FromDiscord<Elegantbeef> That's what addicts say
23:18:11FromDiscord<Robyn [She/Her]> It's also what ADHD peeps say
23:18:32FromDiscord<Robyn [She/Her]> Is `LString` a good name for a string that can't be longer than a certain length?
23:19:08FromDiscord<Elegantbeef> No it's an awful name
23:19:30FromDiscord<Robyn [She/Her]> What would be better? I want a short and concise name :p
23:19:44FromDiscord<Robyn [She/Her]> `VarNum` makes sense to me, `LString` is bad even for me
23:20:23FromDiscord<Elegantbeef> No clue if you want easy `string` interop but temer's got stackstrings which are fixed length and value types
23:20:55FromDiscord<Elegantbeef> If you want easy `string` interop i'd probably just make a `fixedstrings.nim` and call it either `FixedString` or `String`
23:21:17FromDiscord<Robyn [She/Her]> I'll use `FixedString` probably
23:21:34FromDiscord<Robyn [She/Her]> Any reason I can't do `FixedString[T: static int] = string` and call it a day?
23:21:42FromDiscord<Elegantbeef> That's an alias
23:22:05FromDiscord<Elegantbeef> Aliases are not new types so `string is FixedString[10]`
23:22:21FromDiscord<Robyn [She/Her]> Would that mean `T` gets lost then?
23:22:43FromDiscord<Elegantbeef> It means that there is no new distinct type
23:22:47FromDiscord<Elegantbeef> All FixedStrings are strings
23:22:51FromDiscord<Elegantbeef> All strings are fixed strings
23:23:00FromDiscord<Elegantbeef> There is no concept of weak distinct in Nim sadly
23:23:15FromDiscord<Elegantbeef> The closest you get is a converter to the base type
23:23:38FromDiscord<Robyn [She/Her]> Unfortunate
23:23:46FromDiscord<Robyn [She/Her]> I think an alias should be fine here, though
23:23:56FromDiscord<Robyn [She/Her]> All I need is to be able to store a length in the type itself
23:24:06FromDiscord<Robyn [She/Her]> Since I'll be doing validation in the `read` proc
23:24:07FromDiscord<Elegantbeef> And an alias does not give you that
23:24:31FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=vZLnChtcLuxg
23:25:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=WWTdAMlvbcrB
23:25:43FromDiscord<Robyn [She/Her]> I only plan on using it in field declarations so there's no issue for me there
23:25:44FromDiscord<Elegantbeef> Validate the string on creation and use distincts properly or validate it at every use site
23:25:56FromDiscord<Robyn [She/Her]> It's a constraint rather than a limit
23:26:09FromDiscord<Elegantbeef> What?
23:26:10FromDiscord<Robyn [She/Her]> (edit) "limit" => "hard no"
23:26:15FromDiscord<Robyn [She/Her]> Idk how to explain
23:26:33FromDiscord<Robyn [She/Her]> Hold on as I try to find words :p
23:26:35FromDiscord<Elegantbeef> Is it not the maximum size the string can grow to?
23:27:44FromDiscord<Robyn [She/Her]> That's only validated when sent over or read from the network
23:27:49FromDiscord<Robyn [She/Her]> I can show a code example
23:28:43FromDiscord<Elegantbeef> I'd personally just use stack strings as they do not require any GC to parse into, but you do you
23:30:53FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=wBpYyFNrQvWv
23:31:09FromDiscord<Robyn [She/Her]> The last codeblock is rough pseudocode of what I'm planning to do
23:31:17FromDiscord<Elegantbeef> God that's some awful code
23:31:28FromDiscord<Robyn [She/Her]> Which part :p
23:31:36FromDiscord<Robyn [She/Her]> The inheritance?
23:31:38FromDiscord<Elegantbeef> `proc read(_: var YourType)`
23:31:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OKHYRFmqyNFY
23:32:10FromDiscord<Elegantbeef> No "I need to handle every single type branch"
23:32:18FromDiscord<Elegantbeef> You have overloaded dispatch do not do the compiler's job for it
23:32:35FromDiscord<Robyn [She/Her]> Fair enough :P
23:32:55FromDiscord<Elegantbeef> The benefit is then you can handle any custom type without changing your proc
23:33:01FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=gEmswalWmvLH
23:33:02FromDiscord<Elegantbeef> You get generic interfaces which are the bees knees
23:33:30FromDiscord<Elegantbeef> \You could even use traitor and have a `Readable = distinct tuple[read: proc(_: var Atom) {.nimcall.}]` 😛
23:33:36FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "You get generic interfaces": That they are
23:33:39FromDiscord<Elegantbeef> Yes I understand you want to read a set amount of data
23:34:10FromDiscord<Elegantbeef> Using stack strings seems fine I imagine since you highly unlikely need most of strutils I imagine, could be wrong
23:34:34FromDiscord<Elegantbeef> Faster, already written, and ensures you read what you want
23:35:00FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Using stack strings seems": The users might manipulate the string at any point before sending it off, so better to keep it like this imo
23:35:58FromDiscord<Elegantbeef> I do wonder why you're using inheritance for packets
23:37:17FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I do wonder why": Cleaner
23:37:25FromDiscord<Robyn [She/Her]> In terms of code structure at least
23:37:37FromDiscord<Robyn [She/Her]> Tho it doesn't need to be a ref object
23:38:39*spacelucy joined #nim
23:39:54*Batzy_ is now known as Batzy
23:41:18*spacelucy quit (Client Quit)
23:44:25FromDiscord<girvo> In reply to @Elegantbeef "I swear people just": honestly, a little
23:45:36FromDiscord<Robyn [She/Her]> xD
23:46:03*spacelucy joined #nim
23:50:12FromDiscord<that_dude.> I remember reading that I need to call NimMain to start the garbage collector. Does that still apply with orc/arc?
23:51:45FromDiscord<Robyn [She/Her]> For `orc` definitely
23:51:51FromDiscord<Robyn [She/Her]> `NimMain` also initialises globals
23:55:18FromDiscord<that_dude.> Got it
23:56:40FromDiscord<Elegantbeef> You don't need to for orc, but it's good form
23:57:25FromDiscord<Elegantbeef> @girvo I appreciate that response as it means you scrolled up and went "Heh I do"