00:22:18 | * | azimut joined #nim |
00:30:05 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> Lent is a return type borrow that allows you to not copy when directly consumed |
00:36:43 | FromDiscord | <Elegantbeef> It's the immutable `var` return type |
00:48:40 | termer | I need to figure something out with value types |
00:48:44 | termer | I'm in over my head again I think |
00:49:15 | termer | if I have a getter proc on a value type, will it copy the value passed into it? |
00:49:27 | termer | also, how do I avoid an object being copied at all |
00:49:35 | termer | I recall there was something like overriding =copy and/or =dup |
00:49:37 | termer | I forget how though |
00:51:20 | termer | Would using var as the arg type avoid copying on those |
01:04:42 | FromDiscord | <Elegantbeef> Objects equal or larger than sizeof(float) \ 3 are copied by reference |
01:04:46 | FromDiscord | <Elegantbeef> passed by reference\ |
01:05:04 | FromDiscord | <Elegantbeef> You can make `proc =dup(_: MyType): MyType {.error.}` |
01:06:16 | FromDiscord | <Elegantbeef> You can also explicitly annotate `byref` but if you want no copies disable copy and dup |
01:11:21 | termer | bigger than float are passed by reference? |
01:11:30 | FromDiscord | <Elegantbeef> \3 |
01:12:49 | termer | divided by 3? |
01:12:51 | termer | whqat |
01:12:52 | termer | *what |
01:13:08 | FromDiscord | <Elegantbeef> irc moment |
01:13:13 | FromDiscord | <Elegantbeef> bigger than three floats |
01:13:42 | FromDiscord | <Elegantbeef> Basically do not worry about passing by value vs. reference Nim does the 'right' thing |
01:19:47 | FromDiscord | <Elegantbeef> @Robyn [She/Her] is there a reason you constrained to nimcall? |
01:23:57 | * | jmdaemon joined #nim |
01:25:53 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> I assume the idea is that you do not need to worry about timeout as blocking is a non issue |
01:27:12 | termer | asyncnet sucks is why |
01:27:53 | FromDiscord | <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:23 | FromDiscord | <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:38 | FromDiscord | <girvo> or rather, httpclient |
01:29:27 | FromDiscord | <girvo> And httpclient just `.wait(duration)`'s the Future |
01:30:48 | termer | I think chronos does have a timeout thing |
01:30:54 | termer | it's just built into Future since they can be canceled |
01:30:58 | FromDiscord | <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:59 | termer | their system is more sophisticated |
01:31:09 | FromDiscord | <girvo> In reply to @termer "it's just built into": yeah that's `wait()` |
01:31:21 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=UuhQtKFugRHa |
01:31:40 | FromDiscord | <girvo> Which makes sense I think, just wanted to make sure I wasn't missing something obvious lol |
01:34:20 | FromDiscord | <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:12 | FromDiscord | <Elegantbeef> Nice |
01:40:27 | * | Batzy quit (Ping timeout: 264 seconds) |
01:40:51 | FromDiscord | <Elegantbeef> Do you have a nice nimscript task of deploy? 😄 |
01:50:13 | FromDiscord | <girvo> In reply to @Elegantbeef "Do you have a": Not yet, but thats the next task 😄 |
01:50:18 | FromDiscord | <girvo> to be executed by CircleCI haha |
01:50:30 | FromDiscord | <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:13 | FromDiscord | <girvo> Its not in v3.2.0 or v4.0.0 or master |
01:52:55 | FromDiscord | <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:29 | FromDiscord | <girvo> Oh! I found an example at least: https://github.com/status-im/nim-chronos/pull/478/files |
01:56:39 | FromDiscord | <girvo> I _really_ want to use Chronos instead of asyncnet here, but for raw TCP/IP code it seems very undocumented sadly |
02:00:17 | FromDiscord | <girvo> I guess my best bet is just to go through apps/httpclient |
02:01:16 | FromDiscord | <girvo> Or rather, httpserver |
02:21:39 | FromDiscord | <sent44> sent a long message, see https://pasty.ee/ZWlhBMxltGQj |
02:50:26 | * | zdl joined #nim |
03:17:19 | zdl | hi, 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:19 | zdl | : 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:54 | FromDiscord | <Elegantbeef> `int` != `BiggestInt` |
03:17:59 | FromDiscord | <Elegantbeef> Convert the one to the other |
03:20:32 | * | derpydoo quit (Ping timeout: 268 seconds) |
03:23:29 | zdl | that doesn't fix the problem, the error appears even if i add a static value to the sequence, like speeds.add(3) |
03:35:43 | FromDiscord | <Elegantbeef> Ah it's a gcsafeness issue |
03:35:56 | FromDiscord | <Elegantbeef> `{.cast(gcSafe).}: mySeq.add ...` solves it |
03:36:02 | FromDiscord | <Elegantbeef> Ugly as sin though |
03:52:50 | zdl | yep, that fixes the problem |
03:52:53 | zdl | thanks! |
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:50 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=zWHBmfAYaiIg |
04:34:17 | FromDiscord | <Elegantbeef> What's the issue? |
04:35:33 | FromDiscord | <madonuko> > it's stuck |
04:35:42 | FromDiscord | <madonuko> at the last line |
04:35:51 | FromDiscord | <Elegantbeef> Ah sorry I just read the output |
04:36:09 | FromDiscord | <madonuko> oh lol, take your time |
04:36:47 | FromDiscord | <Elegantbeef> Why are you doing `mold -run`? |
04:37:18 | FromDiscord | <madonuko> it usually makes builds slightly faster |
04:37:40 | FromDiscord | <madonuko> I don't think that'd be an issue though, right…? |
04:37:50 | FromDiscord | <Elegantbeef> I mean mold would if you used the linker |
04:38:21 | FromDiscord | <madonuko> I built the entire nim compiler using mold and it went fine |
04:38:23 | FromDiscord | <Elegantbeef> No clue could be an conflict |
04:38:54 | FromDiscord | <madonuko> hmm ok |
04:39:16 | FromDiscord | <madonuko> what does the git fatal message mean though |
04:39:16 | FromDiscord | <Elegantbeef> Though ime `mold` does not help in Nim compilation much |
04:39:49 | FromDiscord | <madonuko> I see |
04:39:50 | FromDiscord | <Elegantbeef> What fatal, I'm blind |
04:40:38 | FromDiscord | <madonuko> sent a code paste, see https://play.nim-lang.org/#pasty=TTzqVUlgWbDu |
04:41:02 | FromDiscord | <madonuko> it tried to build… nimble? and then git didn't work…? |
04:41:45 | FromDiscord | <madonuko> fatal: not a git repository |
04:41:50 | FromDiscord | <madonuko> I've no idea where this comes from |
04:42:09 | FromDiscord | <madonuko> I' |
04:42:31 | FromDiscord | <madonuko> I've just tried without mold, same issue, so probably… some really weird bugs |
04:44:23 | FromDiscord | <leorize> it's fine, nimble binary runs git to get the hash to embed into the binary |
04:44:35 | FromDiscord | <leorize> but nothing will break if that couldn't happen |
04:44:54 | FromDiscord | <Elegantbeef> Yea that fatal is not in the build log so it can sorta be ignored |
04:45:32 | FromDiscord | <madonuko> ah… but I mean I cloned the repo with git so I'm a bit confused |
04:45:50 | FromDiscord | <madonuko> but guess that's not the issue |
04:46:39 | FromDiscord | <leorize> if the build hangs then you probably should do it by hand |
04:48:08 | FromDiscord | <leorize> run `nimble setup` in choosenim directory and you can run `nim c src/choosenim` which should show some more details |
04:48:35 | FromDiscord | <madonuko> ok let me try |
04:54:31 | FromDiscord | <madonuko> so somehow that worked |
04:55:46 | FromDiscord | <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:02 | FromDiscord | <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:25 | FromDiscord | <madonuko> using `nim c` works perfectly though |
04:56:45 | FromDiscord | <madonuko> maybe a bug report…? |
05:07:36 | * | SchweinDeBurg joined #nim |
05:30:20 | * | azimut quit (Ping timeout: 255 seconds) |
05:55:46 | FromDiscord | <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:02 | FromDiscord | <morgan> i realized it was probably something like that before i profiled it |
05:56:22 | FromDiscord | <morgan> when i converted the convolution to use avx2 simd and saw little change in performance |
05:56:31 | FromDiscord | <morgan> so i need to optimize the memory access |
05:57:03 | FromDiscord | <morgan> im using at ContiguousIndex for 1D indexing |
05:57:16 | FromDiscord | <morgan> and i need 8 values at a time |
05:58:50 | FromDiscord | <morgan> oh and i tried release build mode |
05:58:59 | FromDiscord | <morgan> i didn't try danger, maybe that would help |
06:03:02 | FromDiscord | <morgan> doesn't look like it did anything |
06:08:22 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "<@524288464422830095> is there a": Didn't realise I could use a different calling convention aha |
06:09:27 | FromDiscord | <Elegantbeef> closure would probably be ideal so you can capture data |
06:11:23 | FromDiscord | <Robyn [She/Her]> Fair |
06:11:32 | FromDiscord | <Robyn [She/Her]> I might tinker around with it later then |
06:11:47 | FromDiscord | <Robyn [She/Her]> I only did it like this because it's Good Enough™️ for my usecase |
06:33:17 | FromDiscord | <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:48 | FromDiscord | <girvo> sent a long message, see https://pasty.ee/EhcmpMhDvSJS |
06:37:11 | FromDiscord | <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:25 | FromDiscord | <intellij_gamer> ( @madonuko ) |
06:41:52 | * | advesperacit joined #nim |
06:42:08 | FromDiscord | <madonuko> alright |
06:58:24 | FromDiscord | <morgan> i think im gonna try using `ptr` |
06:58:38 | FromDiscord | <morgan> i think there's a way to load from a pointer |
06:58:55 | FromDiscord | <morgan> so hopefully i can get that working with offsets |
06:59:05 | FromDiscord | <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:42 | FromDiscord | <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:27 | FromDiscord | <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:35 | Amun-Ra | hmm, what's the easiest way to get the name of a variable as string in compiletime? |
09:34:45 | FromDiscord | <Elegantbeef> `astToStr` |
09:35:18 | Amun-Ra | thanks |
09:38:08 | FromDiscord | <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:35 | FromDiscord | <Elegantbeef> Well for type information atleast |
09:39:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=IkDJiHYobvYz |
09:43:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=RZnMFZpMdAFX |
09:44:14 | FromDiscord | <Elegantbeef> Since JS does not have arity that should just work |
09:46:05 | Amun-Ra | Elegantbeef: astToStr doesn't exactly work as I expected: https://play.nim-lang.org/ |
09:46:07 | Amun-Ra | argh |
09:46:13 | Amun-Ra | https://play.nim-lang.org/#pasty=fgCMErwpaHWn |
09:46:32 | FromDiscord | <Elegantbeef> const's arent vars |
09:46:38 | Amun-Ra | right |
09:47:01 | Amun-Ra | is there any way I could get "Foo"? |
09:47:08 | FromDiscord | <Elegantbeef> `macro stringify(s: untyped): untyped = newLit(s)` |
09:47:13 | FromDiscord | <Elegantbeef> But it's untyped so `Foop` works |
09:47:45 | FromDiscord | <Elegantbeef> This is a common nuisance with consts |
09:53:59 | Amun-Ra | everytime I go back to writing macros after some time I feel like I'm starting from scratch ;) |
09:58:55 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Dispatching might work with": Huh... I mean, I could definitely try it |
09:59:14 | Amun-Ra | https://play.nim-lang.org/#pasty=CsbXNNoSichj |
10:01:42 | FromDiscord | <Elegantbeef> I mean you're using a template |
10:01:50 | FromDiscord | <Elegantbeef> Templates are code subsitutions, not macros |
10:04:35 | FromDiscord | <Robyn [She/Her]> I'm assuming asyncdispatch doesn't work with JS? |
10:04:46 | Amun-Ra | newLit returns NimNode, strVal should return string, yet an error pops up: https://play.nim-lang.org/#pasty=YUFaOmWayAQz |
10:05:10 | FromDiscord | <Elegantbeef> `s.newLit` returns a `newLit(NimNode)` |
10:05:27 | FromDiscord | <Elegantbeef> That NimNode literal does not have a strval |
10:05:52 | Amun-Ra | ah, so it returns string only if there a string value assigned |
10:06:03 | FromDiscord | <Elegantbeef> You also are attempting to return a string in a macro |
10:06:08 | FromDiscord | <Elegantbeef> You can only return nimnodes in macros |
10:06:16 | FromDiscord | <Elegantbeef> So stop using types on a macro's return value |
10:06:23 | FromDiscord | <Elegantbeef> use `untyped` if it can be an expression |
10:07:28 | Amun-Ra | I remember I had to use macro+template pair a few times before |
10:08:24 | Amun-Ra | Error: request to generate code for .compileTime proc: $; I'll leave it for later… ;) |
10:10:57 | FromDiscord | <Elegantbeef> Yea just use my macro and stop hurting yourself |
10:11:21 | FromDiscord | <Elegantbeef> Whoops that was `newLit(s.repr)` |
10:11:28 | FromDiscord | <Elegantbeef> Oopsie |
10:11:34 | Amun-Ra | hmm |
10:11:59 | FromDiscord | <Elegantbeef> `macro stringify(s: untyped): untyped = newLit(s.repr)` will stringify any untyped expression |
10:12:41 | Amun-Ra | but that'll stringify the value and not the label |
10:13:11 | Amun-Ra | wait there's difference between stingify(Foo) and Foo.stringify |
10:13:27 | Amun-Ra | first one returns label, second one value |
10:14:12 | Amun-Ra | https://play.nim-lang.org/#pasty=wakiljIdTIjI |
10:14:17 | Amun-Ra | I got used to that syntax |
10:15:18 | FromDiscord | <Elegantbeef> Yes method call forces semantic analysis |
10:15:53 | FromDiscord | <Elegantbeef> Think about it to know what to call `x` in `x.y` must be analysed before `y` |
10:16:18 | Amun-Ra | ah |
10:16:28 | Amun-Ra | makes sense, thanks |
10:42:36 | FromDiscord | <mratsim> In reply to @morganalyssa "i think there's a": https://github.com/mratsim/laser/blob/master/laser/simd.nim#L50-L51 |
10:48:30 | FromDiscord | <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:47 | FromDiscord | <mratsim> sent a long message, see https://pasty.ee/fNSQWugkpfPN |
10:52:00 | FromDiscord | <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:35 | FromDiscord | <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:48 | FromDiscord | <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:05 | NimEventer | New 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:52 | FromDiscord | <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:10 | FromDiscord | <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:08 | FromDiscord | <morgan> In reply to @mratsim "are you using the": and i wrote my own convolution, because i needed something custom |
18:21:10 | FromDiscord | <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:30 | FromDiscord | <morgan> single channel, unlimited kernel size |
18:23:34 | FromDiscord | <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:41 | FromDiscord | <morgan> @mratsim |
18:24:21 | * | rockcavera joined #nim |
18:24:21 | * | rockcavera quit (Changing host) |
18:24:21 | * | rockcavera joined #nim |
18:25:48 | FromDiscord | <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:59 | FromDiscord | <morgan> now that it’s so much faster i might actually render out even larger versions |
18:33:06 | FromDiscord | <morgan> not sure whether i want to make them multi-resolution (more quads to render) or have separate versions |
18:34:19 | FromDiscord | <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:33 | FromDiscord | <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:45 | FromDiscord | <MDuardo> I don't have GCC or Clang |
20:40:05 | FromDiscord | <nnsee> if you can compile binaries, you definitely have either gcc or clang |
20:40:26 | FromDiscord | <nnsee> i suspect you'll have to inspect the nix recipe as the ultimate source of truth |
20:41:34 | FromDiscord | <odexine> installing nim on nixos gives you gcc, but it doesnt expose it outside of nim |
20:41:47 | FromDiscord | <odexine> because thats kinda how nix(os) works |
20:49:36 | FromDiscord | <leorize> nixpkgs have dependencies coded into programs directly |
20:49:38 | FromDiscord | <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:33 | FromDiscord | <huantian> to be more specific, the `nim` and `nim2` derivations are wrappers around `nim(2)-unwrapped` |
20:54:05 | FromDiscord | <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:48 | FromDiscord | <MDuardo> Thank you very much, I will look into it to understand it better |
20:55:01 | FromDiscord | <sirius_3x> sent a long message, see https://pasty.ee/PMpYrLnWZuoN |
20:55:12 | FromDiscord | <sirius_3x> sry forgot formatting |
20:55:25 | FromDiscord | <sirius_3x> (edit) "long message," => "code paste," | "https://pasty.ee/BzdKtnbmASCO" => "https://play.nim-lang.org/#pasty=PFSGVFkKaTkd" |
20:57:29 | FromDiscord | <sirius_3x> nvm, round brackets worked |
20:57:44 | FromDiscord | <sirius_3x> does it become a tuple then tho? |
20:58:38 | FromDiscord | <huantian> yes |
20:58:58 | FromDiscord | <sirius_3x> In reply to @huantian "yes": ty |
20:59:23 | FromDiscord | <huantian> i'd ask why nested arrays wouldn't be a good option for you |
21:02:18 | FromDiscord | <odexine> i would ask as well |
21:02:18 | FromDiscord | <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:31 | FromDiscord | <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:08 | FromDiscord | <huantian> the issue is that they mean different things |
21:04:25 | FromDiscord | <huantian> the idea of tuples is that the elements may not all be the same type |
21:04:39 | FromDiscord | <huantian> whereas in a matrix you know that all the rows should have the same element type, same number of columns |
21:04:57 | FromDiscord | <huantian> if it's an issue in terms of reading, then perhaps you can just add a comment |
21:04:59 | FromDiscord | <sirius_3x> does that create additional overhead for this type though? |
21:05:25 | FromDiscord | <sirius_3x> like, does the tuple take up more space ? |
21:05:34 | FromDiscord | <odexine> it creates different semantics and behaviour |
21:05:42 | FromDiscord | <odexine> you will program differently between the two versions |
21:05:53 | FromDiscord | <odexine> there are heavier limitations when using tuples |
21:06:01 | FromDiscord | <odexine> (in the use case of a matrix) |
21:06:56 | FromDiscord | <sirius_3x> sry for asking, but what kind of limitations would that be? |
21:07:34 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#pasty=qHqjPDcdBsjx |
21:07:35 | FromDiscord | <huantian> consider this code |
21:07:39 | FromDiscord | <sirius_3x> ay |
21:08:19 | FromDiscord | <sirius_3x> though i dont know what .low and .high mean tbh, sry |
21:08:28 | FromDiscord | <huantian> the corresponding code doesn't compile for tuples: |
21:08:32 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#pasty=JAPEODtKhtVh |
21:08:50 | FromDiscord | <sirius_3x> you cant reference entries by [i][j] ? |
21:09:12 | FromDiscord | <huantian> you can only index tuples by `[i]` if `i` is known at compile time |
21:09:21 | FromDiscord | <sirius_3x> oh thats sad |
21:10:32 | FromDiscord | <sirius_3x> thank you for the example!↵so then i will have to just do a nested array? no workarounds? |
21:10:52 | FromDiscord | <odexine> yes |
21:11:16 | FromDiscord | <sirius_3x> alrighty, ty both! very helpful |
21:11:42 | FromDiscord | <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:26 | FromDiscord | <sirius_3x> oh ok, so high is equal to just using .len? |
21:12:37 | FromDiscord | <sirius_3x> on the array i mean |
21:12:57 | FromDiscord | <sirius_3x> (edit) "high" => ".high" |
21:13:05 | FromDiscord | <odexine> no |
21:13:10 | FromDiscord | <odexine> high is like len-1 |
21:13:24 | FromDiscord | <odexine> ...but not necessarily, but that's a more advanced topic |
21:13:27 | FromDiscord | <sirius_3x> ahhh |
21:20:06 | * | xet7 quit (Remote host closed the connection) |
21:21:23 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=AYDrsBNxSUej |
21:21:31 | FromDiscord | <Robyn [She/Her]> Orc should work with that code, right? |
21:24:15 | FromDiscord | <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:01 | FromDiscord | <Robyn [She/Her]> Hey Beef, can `{.nimcall.}`s function as a `{.closure.}` if I cast it? |
21:36:29 | FromDiscord | <leorize> no |
21:36:36 | FromDiscord | <odexine> darn beat to the punch\ |
21:36:43 | FromDiscord | <leorize> but you can just assign it directly |
21:36:58 | FromDiscord | <leorize> and nim will generate a wrapper for you |
21:36:58 | FromDiscord | <Robyn [She/Her]> Wdym by assigning it directly? |
21:37:17 | FromDiscord | <leorize> basically just use it in context where you need a closure |
21:37:30 | FromDiscord | <Robyn [She/Her]> Oh okay! Thanks! |
21:39:17 | FromDiscord | <Robyn [She/Her]> Ah it now needs to be annotated as GC safe |
21:39:18 | FromDiscord | <Robyn [She/Her]> Makes senze |
21:39:20 | FromDiscord | <Robyn [She/Her]> Sense |
21:40:12 | FromDiscord | <Robyn [She/Her]> Nvm that wasn't the issue |
21:42:58 | FromDiscord | <Robyn [She/Her]> It'd probably be easier to just accept a `nimcall` oof- |
21:43:25 | * | ntat quit (Quit: Leaving) |
21:43:46 | FromDiscord | <leorize> maybe you can post the error message here |
21:43:54 | FromDiscord | <leorize> and we can see what's the jig |
21:44:16 | FromDiscord | <Robyn [She/Her]> I'll put the code on the playground after trimming it ehe |
21:48:41 | FromDiscord | <Robyn [She/Her]> Ah well now I'm getting a different error- |
21:51:40 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=QvvyygPOXYna |
21:56:49 | FromDiscord | <odexine> `proc (a: A, b: A){.gcsafe.}` probably doesnt match `ListenerProcs[T, R]` |
21:58:26 | FromDiscord | <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:23 | FromDiscord | <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:00 | FromDiscord | <Robyn [She/Her]> That was not a solution, type mismatch still exists |
22:02:56 | FromDiscord | <Robyn [She/Her]> Eh, not that much of an issue for me, I can live without it being a closure |
22:24:11 | FromDiscord | <girvo> sent a code paste, see https://play.nim-lang.org/#pasty=AtSUrEkksQts |
22:35:08 | FromDiscord | <Robyn [She/Her]> Ughh... Beef may actually make me use traitor- |
22:36:14 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=iLnmQpobkFZH |
22:37:36 | FromDiscord | <Robyn [She/Her]> Test time |
22:38:21 | FromDiscord | <Robyn [She/Her]> Yep oof |
22:38:41 | FromDiscord | <Robyn [She/Her]> Unless I just make a macro for `write` and `read` so it can use the defined fields |
22:41:40 | FromDiscord | <odexine> the field names of a tuple have no bearing on type matching iirc |
22:43:05 | FromDiscord | <Robyn [She/Her]> In reply to @chronos.vitaqua "Unless I just make": Hmm... How to get the type of a field- |
22:43:11 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "the field names of": Fair enough |
22:43:21 | FromDiscord | <Robyn [She/Her]> In reply to @chronos.vitaqua "Hmm... How to get": Type of a field from a string |
22:43:56 | FromDiscord | <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:27 | FromDiscord | <Robyn [She/Her]> In reply to @girvo "yeah thats the whole": Makes sense |
22:44:36 | FromDiscord | <Robyn [She/Her]> I don't want structural matching here so, 🤷♀️ |
22:44:43 | FromDiscord | <odexine> In reply to @chronos.vitaqua "Type of a field": ...? |
22:45:49 | FromDiscord | <girvo> In reply to @chronos.vitaqua "I don't want structural": does an `object` not fit? |
22:46:45 | FromDiscord | <Robyn [She/Her]> In reply to @girvo "does an `object` not": It does yeah |
22:46:50 | FromDiscord | <Robyn [She/Her]> Just wanna make a generic for it |
22:48:51 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "...?": I figured that out |
22:49:10 | * | advesperacit quit () |
22:49:40 | FromDiscord | <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:26 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=iHyaFWgjQluS |
22:50:29 | FromDiscord | <Robyn [She/Her]> Something like that |
22:51:59 | FromDiscord | <Elegantbeef> ooooooh noooooooo↵(@Robyn [She/Her]) |
22:54:00 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "ooooooh noooooooo (<@524288464422830095>)": I avoided your grasp for now :P |
22:54:15 | FromDiscord | <Robyn [She/Her]> Hoping to be able to do this without any dynamic dispatch |
22:54:21 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=iVwewNLKFKVc |
22:55:47 | FromDiscord | <Elegantbeef> A fields loop + when is so hard |
22:56:17 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=MMrScwhIausM |
22:56:25 | FromDiscord | <odexine> yyyyyyyes |
22:56:28 | FromDiscord | <Robyn [She/Her]> Like, is it unneccessary to have it? |
22:56:29 | FromDiscord | <Robyn [She/Her]> Ah |
22:56:33 | FromDiscord | <Elegantbeef> Yes |
22:56:34 | FromDiscord | <odexine> see what beef said |
22:56:49 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "A fields loop +": I don't know the specific packet's fields |
22:56:57 | FromDiscord | <odexine> well you dont need to? |
22:57:06 | FromDiscord | <Robyn [She/Her]> I don't get what you mean then? |
22:57:14 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=HCXVgTohJedj |
22:57:18 | FromDiscord | <odexine> for name, field in x.fieldpairs: when name == thestring: field = thevalue |
22:57:23 | FromDiscord | <odexine> ok |
22:57:27 | FromDiscord | <odexine> ok beef ok |
22:57:38 | FromDiscord | <Elegantbeef> Rika this aint no foot race |
22:57:52 | FromDiscord | <odexine> my excuse is that i havent slept in how many hours |
22:57:57 | FromDiscord | <girvo> chronos makes nimsuggest die quite spectacularly lol |
22:58:08 | FromDiscord | <odexine> what doesnt make nimsuggest die quite spectacularly |
22:58:30 | FromDiscord | <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:42 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=fwQtBYQPNjcG |
22:59:09 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=oKOfrdefSPjP |
22:59:24 | FromDiscord | <Elegantbeef> Why template? |
22:59:36 | FromDiscord | <Elegantbeef> I swear people just write shit code to spite me |
23:00:13 | FromDiscord | <Robyn [She/Her]> I was gonna change it to a proc after seeing your code :p |
23:04:13 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "I swear people just": Also, I do :D |
23:04:30 | FromDiscord | <Robyn [She/Her]> I hope my event library wasn't that bad th |
23:08:08 | FromDiscord | <Elegantbeef> Why were you even considering traitor? |
23:09:16 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Why were you even": I have no idea honestly |
23:09:27 | FromDiscord | <Robyn [She/Her]> Didn't even need it nor do I think it'd help |
23:09:28 | FromDiscord | <Elegantbeef> PS traitor does not force runtime dispatch |
23:09:31 | FromDiscord | <Elegantbeef> It enables it |
23:09:39 | FromDiscord | <Elegantbeef> But you can use it fully with static dispatch |
23:10:29 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=uOGvPsgsMCKv |
23:10:45 | FromDiscord | <Elegantbeef> `converter` yes it is |
23:10:49 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "It enables it": Ooooh nice! No disadvantage then! |
23:11:16 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> Converters explode in your face 9/10times |
23:11:41 | FromDiscord | <Elegantbeef> But that aside what does `VarNum` even mean |
23:12:08 | FromDiscord | <Robyn [She/Her]> It's a type specific to the network stuff, hold on |
23:12:23 | FromDiscord | <Elegantbeef> Is it a variable length integer? |
23:12:34 | FromDiscord | <Robyn [She/Her]> https://wiki.vg/Protocol#Definitions:varint & https://wiki.vg/Protocol#Definitions:varlong |
23:12:40 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Is it a variable": Yep- |
23:12:43 | FromDiscord | <Robyn [She/Her]> (edit) "Yep-" => "Yep!" |
23:12:56 | FromDiscord | <Elegantbeef> Believe it or not you can do `VariableLength[T:]` |
23:13:17 | FromDiscord | <Robyn [She/Her]> `VariableLength[T:]`? |
23:13:29 | FromDiscord | <Elegantbeef> Or if you want to be more concise `Variable[T:...]` |
23:13:39 | FromDiscord | <Elegantbeef> Instead of `VarNum` which is a silly name 😛 |
23:13:57 | FromDiscord | <Robyn [She/Her]> VarNum makes sense to me because I'm reading from the docs :p |
23:14:23 | FromDiscord | <Elegantbeef> But it seems fine |
23:14:27 | FromDiscord | <Robyn [She/Her]> I'm gonna hope the converter doesn't blow up in my face :P |
23:14:31 | FromDiscord | <Elegantbeef> PS you can quit being so silly |
23:14:37 | FromDiscord | <Robyn [She/Her]> Oh sorry |
23:14:47 | FromDiscord | <Robyn [She/Her]> I got into the habit of doing that everywhere again |
23:14:50 | FromDiscord | <Elegantbeef> `converter toVarNum[T: uint32 or uint64](var: T): VarNum[T] = VarNum[T](var)` |
23:15:46 | FromDiscord | <Robyn [She/Her]> That's cleaner |
23:15:52 | FromDiscord | <Robyn [She/Her]> My brain is chronically exhausted |
23:17:16 | FromDiscord | <Elegantbeef> Stop drinking monsters |
23:17:28 | FromDiscord | <Robyn [She/Her]> I haven't drank one in a week now |
23:17:39 | FromDiscord | <Robyn [She/Her]> Also they make me calmer and sleep better :p |
23:17:51 | FromDiscord | <Elegantbeef> That's what addicts say |
23:18:11 | FromDiscord | <Robyn [She/Her]> It's also what ADHD peeps say |
23:18:32 | FromDiscord | <Robyn [She/Her]> Is `LString` a good name for a string that can't be longer than a certain length? |
23:19:08 | FromDiscord | <Elegantbeef> No it's an awful name |
23:19:30 | FromDiscord | <Robyn [She/Her]> What would be better? I want a short and concise name :p |
23:19:44 | FromDiscord | <Robyn [She/Her]> `VarNum` makes sense to me, `LString` is bad even for me |
23:20:23 | FromDiscord | <Elegantbeef> No clue if you want easy `string` interop but temer's got stackstrings which are fixed length and value types |
23:20:55 | FromDiscord | <Elegantbeef> If you want easy `string` interop i'd probably just make a `fixedstrings.nim` and call it either `FixedString` or `String` |
23:21:17 | FromDiscord | <Robyn [She/Her]> I'll use `FixedString` probably |
23:21:34 | FromDiscord | <Robyn [She/Her]> Any reason I can't do `FixedString[T: static int] = string` and call it a day? |
23:21:42 | FromDiscord | <Elegantbeef> That's an alias |
23:22:05 | FromDiscord | <Elegantbeef> Aliases are not new types so `string is FixedString[10]` |
23:22:21 | FromDiscord | <Robyn [She/Her]> Would that mean `T` gets lost then? |
23:22:43 | FromDiscord | <Elegantbeef> It means that there is no new distinct type |
23:22:47 | FromDiscord | <Elegantbeef> All FixedStrings are strings |
23:22:51 | FromDiscord | <Elegantbeef> All strings are fixed strings |
23:23:00 | FromDiscord | <Elegantbeef> There is no concept of weak distinct in Nim sadly |
23:23:15 | FromDiscord | <Elegantbeef> The closest you get is a converter to the base type |
23:23:38 | FromDiscord | <Robyn [She/Her]> Unfortunate |
23:23:46 | FromDiscord | <Robyn [She/Her]> I think an alias should be fine here, though |
23:23:56 | FromDiscord | <Robyn [She/Her]> All I need is to be able to store a length in the type itself |
23:24:06 | FromDiscord | <Robyn [She/Her]> Since I'll be doing validation in the `read` proc |
23:24:07 | FromDiscord | <Elegantbeef> And an alias does not give you that |
23:24:31 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=vZLnChtcLuxg |
23:25:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=WWTdAMlvbcrB |
23:25:43 | FromDiscord | <Robyn [She/Her]> I only plan on using it in field declarations so there's no issue for me there |
23:25:44 | FromDiscord | <Elegantbeef> Validate the string on creation and use distincts properly or validate it at every use site |
23:25:56 | FromDiscord | <Robyn [She/Her]> It's a constraint rather than a limit |
23:26:09 | FromDiscord | <Elegantbeef> What? |
23:26:10 | FromDiscord | <Robyn [She/Her]> (edit) "limit" => "hard no" |
23:26:15 | FromDiscord | <Robyn [She/Her]> Idk how to explain |
23:26:33 | FromDiscord | <Robyn [She/Her]> Hold on as I try to find words :p |
23:26:35 | FromDiscord | <Elegantbeef> Is it not the maximum size the string can grow to? |
23:27:44 | FromDiscord | <Robyn [She/Her]> That's only validated when sent over or read from the network |
23:27:49 | FromDiscord | <Robyn [She/Her]> I can show a code example |
23:28:43 | FromDiscord | <Elegantbeef> I'd personally just use stack strings as they do not require any GC to parse into, but you do you |
23:30:53 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=wBpYyFNrQvWv |
23:31:09 | FromDiscord | <Robyn [She/Her]> The last codeblock is rough pseudocode of what I'm planning to do |
23:31:17 | FromDiscord | <Elegantbeef> God that's some awful code |
23:31:28 | FromDiscord | <Robyn [She/Her]> Which part :p |
23:31:36 | FromDiscord | <Robyn [She/Her]> The inheritance? |
23:31:38 | FromDiscord | <Elegantbeef> `proc read(_: var YourType)` |
23:31:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OKHYRFmqyNFY |
23:32:10 | FromDiscord | <Elegantbeef> No "I need to handle every single type branch" |
23:32:18 | FromDiscord | <Elegantbeef> You have overloaded dispatch do not do the compiler's job for it |
23:32:35 | FromDiscord | <Robyn [She/Her]> Fair enough :P |
23:32:55 | FromDiscord | <Elegantbeef> The benefit is then you can handle any custom type without changing your proc |
23:33:01 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=gEmswalWmvLH |
23:33:02 | FromDiscord | <Elegantbeef> You get generic interfaces which are the bees knees |
23:33:30 | FromDiscord | <Elegantbeef> \You could even use traitor and have a `Readable = distinct tuple[read: proc(_: var Atom) {.nimcall.}]` 😛 |
23:33:36 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "You get generic interfaces": That they are |
23:33:39 | FromDiscord | <Elegantbeef> Yes I understand you want to read a set amount of data |
23:34:10 | FromDiscord | <Elegantbeef> Using stack strings seems fine I imagine since you highly unlikely need most of strutils I imagine, could be wrong |
23:34:34 | FromDiscord | <Elegantbeef> Faster, already written, and ensures you read what you want |
23:35:00 | FromDiscord | <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:58 | FromDiscord | <Elegantbeef> I do wonder why you're using inheritance for packets |
23:37:17 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "I do wonder why": Cleaner |
23:37:25 | FromDiscord | <Robyn [She/Her]> In terms of code structure at least |
23:37:37 | FromDiscord | <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:25 | FromDiscord | <girvo> In reply to @Elegantbeef "I swear people just": honestly, a little |
23:45:36 | FromDiscord | <Robyn [She/Her]> xD |
23:46:03 | * | spacelucy joined #nim |
23:50:12 | FromDiscord | <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:45 | FromDiscord | <Robyn [She/Her]> For `orc` definitely |
23:51:51 | FromDiscord | <Robyn [She/Her]> `NimMain` also initialises globals |
23:55:18 | FromDiscord | <that_dude.> Got it |
23:56:40 | FromDiscord | <Elegantbeef> You don't need to for orc, but it's good form |
23:57:25 | FromDiscord | <Elegantbeef> @girvo I appreciate that response as it means you scrolled up and went "Heh I do" |