<< 09-03-2023 >>

00:03:35*tiorock joined #nim
00:03:35*tiorock quit (Changing host)
00:03:35*tiorock joined #nim
00:03:35*rockcavera quit (Killed (tungsten.libera.chat (Nickname regained by services)))
00:03:35*tiorock is now known as rockcavera
00:19:31FromDiscord<Nilts> Does karax have custom components like react?
00:49:59NimEventerNew thread by Naterlarsen: Getting a Compile Error - "Error: cannot open file: sockets", see https://forum.nim-lang.org/t/9974
00:53:17*lumo_e quit (Quit: Quit)
00:55:45*Lord_Nightmare2 joined #nim
00:56:18*xet7 quit (Ping timeout: 255 seconds)
00:56:45*anddam quit (Ping timeout: 255 seconds)
00:56:46*Lord_Nightmare quit (Ping timeout: 255 seconds)
00:58:49*Lord_Nightmare2 is now known as Lord_Nightmare
01:02:08FromDiscord<slime> How about rust liked enum compared with case of in Nim🧐
01:09:24*xet7 joined #nim
01:10:00*anddam joined #nim
01:14:15FromDiscord<amadan> In reply to @not logged in "Does karax have custom": Mean you can call a function which returns a VNode to kinda have components
01:14:22*derpydoo joined #nim
01:18:48*derpydoo quit (Ping timeout: 255 seconds)
01:21:47FromDiscord<Nilts> In reply to @amadan "Mean you can call": but can they have their own vars and what not?
01:24:06FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-object-variants↵(@slime)
01:24:44FromDiscord<Elegantbeef> There is not much to compare, rust's 'enum's are more succinct but also require using pattern matching
01:25:24NimEventerNew Nimble package! asyncIters - Async iterators. Able to both await futures and yield values, see https://github.com/SirNickolas/asyncIters-Nim
01:26:14FromDiscord<ringabout> Hi, beef. I was wondering, would you be interested in joining in the mod team?
01:28:03FromDiscord<huantian> yall looking to beef up the mod team? 😛
01:29:15*derpydoo joined #nim
01:33:56FromDiscord<Nilts> Anyone know how to write a match-first parser?
01:38:36FromDiscord<Elegantbeef> I'm not really interested in it, but i've been asked whether i want to be multiple times 😄
01:41:12*arkurious quit (Quit: Leaving)
01:42:42FromDiscord<ringabout> I see. Sorry to bother you 😜 The mod channel now floods with community building related discussions. I'm going to move the discussion to the community channel when it is mature.
01:43:15FromDiscord<Nilts> In reply to @not logged in "Anyone know how to": I can't wrap my head around a system of modular parsing. Like if X succeeds continue on to part Y or back up and go to part Z
01:43:34FromDiscord<Elegantbeef> Doesnt npeg support this?
01:45:02FromDiscord<ringabout> In reply to @ringabout "I see. Sorry to": I shall make more mods join in the nim.devs after the roadmap is finished.
01:45:16FromDiscord<michaelb.eth> In reply to @ringabout "I see. Sorry to": asking out of curiosity, but re: "mod channel" and the query about a participant here joining the mod team, is that in reference to the forum?
01:45:29FromDiscord<michaelb.eth> (edit) "curiosity, but" => "curiosity only:"
01:47:00FromDiscord<Nilts> In reply to @Elegantbeef "Doesnt npeg support this?": Yes. I had a grand idea, but npeg would be simpler! Although for optimizations i might want to use a web-worker.
01:52:56FromDiscord<ringabout> In reply to @michaelb.eth "asking out of curiosity": All platorms.
01:53:01FromDiscord<ringabout> (edit) "platorms." => "platforms."
01:54:35FromDiscord<ringabout> https://media.discordapp.net/attachments/371759389889003532/1083206167813161051/image.png
01:54:51FromDiscord<ringabout> We have made a list for moderators.
02:00:14FromDiscord<michaelb.eth> I'm online in this discord all the time, and look at the forum frequently, though granted I'm just usually checking posts vs. checking long-running discussions. I was trying to understand "floods with community building related discussions.", but I probably haven't been close enough attention.
02:02:19FromDiscord<ringabout> Yeah, we work in a private channel and a private repo.
02:02:26FromDiscord<michaelb.eth> Is there a meta-discussion somewhere about the need for additional mods to help with the flood? Note: I'm not requesting or thinking about being a mod, but I like Nim a lot, just wondering about it.
02:03:10FromDiscord<michaelb.eth> gotcha
02:04:05FromDiscord<michaelb.eth> (edit) "it." => "the need presented."
02:07:26FromDiscord<ringabout> We are going to announce recently accpeted mods on the Nim forum. I suppose it builds on trust, like having contributed to the official Nim related project. A mod is supposed to be helpful and is willing to help with the community building, like reviewing code from contributors and improving the workflow in order to welcome more contributors.
02:07:44FromDiscord<ringabout> (edit) "project." => "projects."
02:10:24FromDiscord<ringabout> Like https://github.com/nim-lang/packages/pull/2532 a mod is supposed to improve the workflow of the Nim infrastructure. This PR intends to incrementally check newly added packages so the CI time will be reduced from 10+ minutes to few seconds.
02:17:24FromDiscord<ringabout> Likewise I'm working on the workflow of the testable specification https://github.com/nim-lang/testspec I might document all the defines here. The mod should build a workflow for contributors and welcome them => https://opensource.guide/building-community
02:17:43FromDiscord<ringabout> (edit) "here." => "there."
02:28:08FromDiscord<michaelb.eth> sent a long message, see http://ix.io/4qiC
02:28:39FromDiscord<michaelb.eth> (edit) "http://ix.io/4qiC" => "http://ix.io/4qiD"
02:29:09FromDiscord<michaelb.eth> (edit) "http://ix.io/4qiD" => "http://ix.io/4qiE"
02:30:48FromDiscord<ringabout> Probably, I didn't notice that since I was admitted into the mod team recently.
02:48:54FromDiscord<Nilts> How would i check if the nim js is nodejs?
02:49:26FromDiscord<Nilts> (I want to disable node for my package)
03:10:42FromDiscord<michaelb.eth> In reply to @ringabout "Probably, I didn't notice": I was making a suggestion, all I meant, you probably didn't missing anything, though I could have.
03:25:15FromDiscord<ringabout> In reply to @michaelb.eth "I was making a": Thank you for your suggestions. I will discuss with other mods.
04:39:59*rmn joined #nim
04:46:24*rmn quit (Quit: Leaving)
04:46:35*rmn joined #nim
04:47:02*rmn quit (Remote host closed the connection)
04:47:07*rmnmjw joined #nim
04:47:49*rmnmjw quit (Remote host closed the connection)
04:47:56*rmnmjw_ joined #nim
04:49:08*rmnmjw__ joined #nim
04:52:48*rmnmjw_ quit (Ping timeout: 248 seconds)
04:54:31*xet7 quit (Ping timeout: 260 seconds)
05:01:36*rmnmjw__ is now known as rmnmjw
05:03:20*azimut_ quit (Ping timeout: 255 seconds)
06:04:03*tiorock joined #nim
06:04:03*tiorock quit (Changing host)
06:04:03*tiorock joined #nim
06:04:03*rockcavera is now known as Guest1646
06:04:03*tiorock is now known as rockcavera
06:06:35*Guest1646 quit (Ping timeout: 248 seconds)
06:09:14*kenran joined #nim
06:30:42*advesperacit joined #nim
06:33:09*Goodbye_Vincent quit (Quit: Ping timeout (120 seconds))
06:33:25*Goodbye_Vincent joined #nim
07:00:48*rockcavera quit (Remote host closed the connection)
07:05:21FromDiscord<Odi> sent a code paste, see https://play.nim-lang.org/#ix=4qjb
07:06:17FromDiscord<Odi> (edit) "https://play.nim-lang.org/#ix=4qjb" => "https://play.nim-lang.org/#ix=4qjc"
07:08:09FromDiscord<Elegantbeef> IO is slow so it's best always to avoid doing each line independantly
07:12:27FromDiscord<albassort> In reply to @Elegantbeef "IO is slow so": this is the same reason why when you parse in streams, you dont go byte by byte
07:12:34FromDiscord<albassort> the bigger the chunks the less the io wait
07:16:56FromDiscord<Elegantbeef> Also did you build with `-d:release`?
07:17:33FromDiscord<Elegantbeef> With `-d:release` on my ryzen 5600x your code is around 5s
07:19:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qjf
07:33:52*onetwo3 quit (Ping timeout: 248 seconds)
07:36:42FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4qjj
07:36:55FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4qjj" => "https://play.nim-lang.org/#ix=4qjk"
07:37:38FromDiscord<Phil> 11th gen Intel Core I7 https://media.discordapp.net/attachments/371759389889003532/1083292495401730110/image.png
07:43:03*onetwo3 joined #nim
08:15:27*Notxor joined #nim
08:24:28FromDiscord<Phil> Nim doesn't have an exact equivalent to typescript union-types right?↵As in, something like↵`type A = "bla" | "blu"`↵With the intention that any value passed into a variable of type A must be a string with the value "bla" or "blu"
08:24:51FromDiscord<Phil> Which in typescript I guess is not enforced at all at runtime and mostly at compile-time, so would only be relevant for static-strings
08:25:03FromDiscord<enthus1ast> enums?
08:25:15FromDiscord<Phil> Benefit over enum would that you don't need to import a file that defines the enum-type
08:25:23FromDiscord<Phil> (edit) "Benefit over enum would ... that" added "be"
08:25:52FromDiscord<Phil> Or rather that's the benefit in typescript for those types, users don't need to be aware an enum or the like even exists, they just pass in strings and when they're invalid they get a compiler-error
08:25:54FromDiscord<enthus1ast> in nim you would like to do a parseEnum
08:26:33FromDiscord<Elegantbeef> Nim just has static values
08:26:56FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qju
08:27:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qjv
08:27:48FromDiscord<Phil> Yeah but that means defining it manually instead of being able to be suprt lazy
08:27:57FromDiscord<Phil> (edit) "suprt" => "super"
08:28:05FromDiscord<Phil> as in, the check
08:28:10FromDiscord<Phil> (edit) "as in, ... themanually" added "defining" | "definingthe check ... " added "manually"
08:28:13FromDiscord<Elegantbeef> Well make the distinct type a module
08:31:30FromDiscord<Elegantbeef> There we go!
08:31:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3tEY
08:33:54FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4qjx
08:34:04FromDiscord<enthus1ast> `Error: signature for '=' must be proc[T: object](x: var T; y: T)`
08:34:38FromDiscord<Elegantbeef> `=` used to be copy, so maybe in the future it might work?
08:56:40FromDiscord<Coachonko> When I brwose the docs I see func and procs, I thought nim uses procs only. What are func then?
08:57:13FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#procedures-func
08:57:46FromDiscord<Coachonko> Oh
08:58:44FromDiscord<Coachonko> I've been writing pure functions with `proc` without knowing
08:58:52FromDiscord<Coachonko> 😎
09:08:30FromDiscord<Andreas> hi, i need the `T` from a `ptr T` ? my proc gets `ptr T` and needs to lookup `T` from a `table[string, int]` . When the proc receives a `T` it get the mapping via `table[$T]`, but that fails for `ptr T` ?
09:08:48FromDiscord<Andreas> (edit) "get" => "gets"
09:09:43FromDiscord<Andreas> (edit) "hi, i need the `T` from a `ptr T` ? my proc gets `ptr T` and needs to lookup `T` from a `table[string, int]` . When the proc receives a `T` it gets the mapping via `table[$T]`, but that fails for `ptr T` ... ?" added "?↵So howto extract the `T`-part from the `ptr T`, pls"
09:10:07FromDiscord<Elegantbeef> How are you writing the procedure?
09:11:03FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4qjF
09:11:41FromDiscord<4zv4l> this is the json file
09:11:43FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4qjG
09:16:09*tinytoast joined #nim
09:18:40*tinystoat quit (Ping timeout: 260 seconds)
09:18:55FromDiscord<Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4qjL
09:19:22*randomuser464876 joined #nim
09:19:43FromDiscord<Andreas> (edit) "https://play.nim-lang.org/#ix=4qjL" => "https://play.nim-lang.org/#ix=4qjM"
09:19:47FromDiscord<Elegantbeef> Why doesnt `$T` work?
09:20:46FromDiscord<Andreas> In reply to @Elegantbeef "Why doesnt `$T` work?": `$T` = "ptr IntSet", well i could put a "ptr IntSet"into the mapping-table...
09:21:06FromDiscord<Andreas> (edit) "IntSet"into" => "IntSet" into"
09:21:09FromDiscord<Elegantbeef> Ok so you want to skip all `ptr` s
09:21:32FromDiscord<Elegantbeef> `typeof(default(T)[])`
09:21:44FromDiscord<Elegantbeef> That skips over one, if you want to skip over all you need a proc
09:22:35FromDiscord<Andreas> In reply to @Elegantbeef "That skips over": thank you man, thats 100% what i was looking for..
09:29:52FromDiscord<tandy> oh, my bad, I'll try it then↵(@djazz)
09:32:54*koltrast quit (Ping timeout: 255 seconds)
09:54:23*azimut joined #nim
09:58:16*koltrast joined #nim
10:14:46Zevv_PMunch: what's the difference between eeprom_write_byte() and eeprom_update_byte() in avr libc?
10:15:08PMunchGood question
10:15:14Zevv_I'm full of good questions
10:15:17Zevv_I'll get the source :)
10:16:03Zevv_bah it's all asm
10:18:42Zevv_hm something about internal functions incrementing or decrementing the address in the return value
10:18:44Amun-Raupdate check if the data differs
10:18:54Amun-Raif it doesn't there's no write
10:19:03Amun-Raand less flash wear
10:19:10Amun-Rachecks*
10:20:23Zevv_ah thanks, where did you get that from?
10:20:36Amun-Ramy /dev/mem :>
10:20:43Amun-Rasec
10:20:52Amun-RaZevv_: https://www.programming-electronics-diy.xyz/2018/07/avr-eeprom-library.html
10:21:10Zevv_takk
10:21:31Amun-Ravaersagod
10:21:50FromDiscord<sOkam!> well, one writes and the other updates, duh 😄
10:24:38*FromDiscord quit (Remote host closed the connection)
10:24:52*FromDiscord joined #nim
10:26:33Zevv_duh
10:28:09FromDiscord<gogolxdong> `/root/nimbus-eth2/tools/generate_makefile.nim(1, 2) Error: cannot open file: ""`
10:28:33FromDiscord<gogolxdong> sent a code paste, see https://play.nim-lang.org/#ix=4qk3
10:50:05*rmnmjw quit (Quit: Leaving)
10:50:24*rmnmjw joined #nim
10:50:25FromDiscord<sOkam!> Is there a way to reference the value of a non-ref variable, before that variable gets its value, in such a way that they both are updated when the first one gets some data?
11:36:15*arkurious joined #nim
11:37:48Amun-Raonly a ptr comes to my mind
11:49:29FromDiscord<sOkam!> i figure i should do what nimgl/vulkan is doing, by having an initializer proc that loads the aliase like they load the real functions 🤷‍♂️
11:49:49FromDiscord<jmgomez> In reply to @sOkam! "Is there a way": doesnt a getter/setter work for you?
11:50:30FromDiscord<sOkam!> its for a proc variable. do getter/setters work on proc?
11:51:26FromDiscord<jmgomez> as long as it's a variable inside a type it should
11:51:47FromDiscord<jmgomez> (edit) "type" => "object"
11:52:08FromDiscord<sOkam!> they are not, afaik
11:52:24FromDiscord<sOkam!> since they are vulkan procs linked when the app initializes
13:03:34*rockcavera joined #nim
13:05:37*junaid_ joined #nim
13:12:47*junaid_ quit (Remote host closed the connection)
13:16:09*junaid_ joined #nim
13:25:49FromDiscord<Nerve> Why might a library I'm statically linking work fine in a debug build and then just...silently do nothing in a release build?
13:36:03*junaid_ quit (Remote host closed the connection)
13:38:52Amun-Rathere must be a different issue with the code
13:45:47*derpydoo quit (Ping timeout: 248 seconds)
14:00:57*derpydoo joined #nim
14:05:29FromDiscord<Nilts> In nim, if threads have there own memory, how do they access functions, consts, etc?
14:06:20FromDiscord<enthus1ast> could be that you must build both, the lib and the host in release or debug↵(@Nerve)
14:07:09FromDiscord<enthus1ast> i had troubles in the past mixing both.
14:09:43FromDiscord<Nerve> It's a C library, so how would I go about that? Do I need to compile the library's .a file with the same optimization flags as `-d:release`?
14:17:25Amun-Raif nim is optimizing it out -- you're not calling any part of the lib
14:23:43*azimut quit (Remote host closed the connection)
14:24:27*azimut joined #nim
14:31:52FromDiscord<Nerve> I definitely am...that's super odd
14:32:29FromDiscord<Nerve> Are my bindings not being assertive enough? I'm using `{.importc.}`, do I need more?
14:32:51FromDiscord<enthus1ast> ah ok, i thought it was a nim lib.↵(@Nerve)
14:37:01Amun-RaNerve: do you call any of the bindings?
14:38:31FromDiscord<Nerve> In reply to @Nerve "I definitely am...that's super": Yes
14:40:20Amun-Rahmm
14:40:54FromDiscord<Nerve> I think I see what's going on
14:42:32FromDiscord<Nerve> It's a C function that drops results into pointers, and only returns a code. I actually check that code to see if it failed. Still, if I compile `-d:release`, it does nothing. However, immediately following the function call, if I print the result code, then it works and the C function actually runs.
14:42:54FromDiscord<Nerve> (edit) "It's a C function that drops results into pointers, and only returns a code. I actually check that code ... to" added "with an `if` statement"
14:43:38FromDiscord<Nerve> So something about resolving the result code is causing Nim or gcc to snip the foreign function entirely or not, depending.
14:44:02FromDiscord<Nerve> This being with `-d:release` optimizations, of course.
14:44:46FromDiscord<gogolxdong> nimbus-eth2 syncing https://media.discordapp.net/attachments/371759389889003532/1083399988261965954/image.png
14:51:04FromDiscord<gogolxdong> what's the difference between nimbus-eth1 and nimbus-eth2
15:11:11*Notxor quit (Remote host closed the connection)
15:20:15FromDiscord<Gumbercules> one targets ethereum 1.0 and the other, 2.0?
15:20:28FromDiscord<Gumbercules> that's just a guess...
15:28:37FromDiscord<Nerve> In reply to @Nerve "It's a C function": Is there anybody around with expertise in the compiler? Should I ask in #internals ?
15:37:05*azimut quit (Remote host closed the connection)
15:37:29*azimut joined #nim
15:44:03FromDiscord<Gumbercules> In reply to @Nerve "Is there anybody around": That would be the place to ask
15:49:56FromDiscord<SpiderDave> how do i turn a float into a string, but if it's an integer like 42.0 then leave off the .0? i still want it to work for values like 1.5 though
15:50:23*PMunch quit (Quit: leaving)
15:57:54FromDiscord<jtv> No way to do that is wrong. You could convert it to an int, and see if the int and float value are the same? Or convert to a string and chop off anything from the dot on, if the rest of the digits are 0. Tho neither approach is awesome without a bunch of extra work if you might have very big or very small numbers where the float might end up getting written in exponential notation.
15:58:47*derpydoo quit (Quit: derpydoo)
16:22:20FromDiscord<SpiderDave> sent a code paste, see https://play.nim-lang.org/#ix=4qmq
16:53:31FromDiscord<Takemichi Hanagaki> Guys, I need some help.↵I've got an object `Date` that makes reference to `DateTime`, and I want to compare both `Date`s, how can I do it without comparing pointers, instead?
16:53:59FromDiscord<Takemichi Hanagaki> (edit) "`DateTime`, and" => "`DateTime`. And" | "both `Date`s," => "two `Date` objects,"
16:54:08FromDiscord<Takemichi Hanagaki> (edit) "And" => "↵And"
16:55:14FromDiscord<Takemichi Hanagaki> My code is: `x.date > y.date` is comparing pointers, instead of its values.
17:09:27*kenran quit (Remote host closed the connection)
17:39:40*ehmry joined #nim
18:01:39*rmnmjw quit (Read error: Connection reset by peer)
18:03:05FromDiscord<Hourglass [She/Her]> I am so confused why my code can't serialise or serialise numbers for the protocol
18:03:05FromDiscord<Hourglass [She/Her]> https://play.nim-lang.org/#ix=4qn0
18:03:25FromDiscord<Hourglass [She/Her]> Seems like single bytes work, but anymore and it just throws a fit
18:03:40FromDiscord<Hourglass [She/Her]> Likely an easy fix with reading 1 byte at a time but still annoying
18:04:48FromDiscord<Hourglass [She/Her]> My serialisation seems to be the broken code
18:04:49NimEventerNew thread by nimnam: Macros and interfacing with the world ?, see https://forum.nim-lang.org/t/9975
18:05:32FromDiscord<Rika> `bigEndianNN` is (dest, src) and not (src, dest)
18:05:40FromDiscord<Rika> you're using it like (src, dest)
18:05:52FromDiscord<Hourglass [She/Her]> Is it the same for `swapEndian`?
18:05:58FromDiscord<Rika> yes
18:06:13FromDiscord<Hourglass [She/Her]> I was using swap endian before but had the same issue
18:06:17FromDiscord<Hourglass [She/Her]> In reply to @Rika "yes": Aah
18:07:26FromDiscord<Hourglass [She/Her]> It works! Thanks for pointing that out Rika!
18:09:59FromDiscord<Rika> also you dont need that cpu endian check
18:14:32FromDiscord<Hourglass [She/Her]> Since I'm using `bigEndian`? I'll remove that rn
18:23:58FromDiscord<Hourglass [She/Her]> I am clueless where this error is coming from ngl
18:24:05FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4qn3
18:24:40*randomuser464876 quit (Quit: Client closed)
18:24:46FromDiscord<Phil> O.O
18:25:16FromDiscord<Phil> I will be honest, I am wondering why you're squeezing that much logic into one line of code
18:25:46FromDiscord<Phil> Wait, that's not even on you, that's the std lib blowing up?
18:26:13FromDiscord<Phil> That looks super weird, what kind of code is doing this?
18:27:46FromDiscord<Hourglass [She/Her]> I have no idea which is what is frustrating me lol
18:30:45FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4qn4
18:30:57FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4qn5
18:32:33FromDiscord<Hourglass [She/Her]> Not even using the `nbPlugin` toggle
18:41:23FromDiscord<Hourglass [She/Her]> Oh! Even weirder: It only breaks on devel
18:41:36FromDiscord<Hourglass [She/Her]> Works perfectly fine on 1.6/10
18:41:38FromDiscord<Hourglass [She/Her]> .10
18:42:00FromDiscord<Hourglass [She/Her]> Using latest devel, but idk how i'd make a minimal reproducible example
18:45:21FromDiscord<Phil> Could you go back to devel and compile with --mm:refc?
18:45:42FromDiscord<Phil> or stay on 1.6.10 and compile with --mm:orc?
18:46:54FromDiscord<Hourglass [She/Her]> In reply to @Isofruit "Could you go back": This is being compiled with `refc` for the tests on both
18:47:31FromDiscord<Hourglass [She/Her]> orc + devel has that same issue
18:48:00FromDiscord<Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "This is being compiled": Wait nvm I just realised arc is the default for devel isnt it
18:48:08FromDiscord<Phil> Nah, orc is
18:48:43FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4qn9
18:49:15FromDiscord<Phil> sent a long message, see http://ix.io/4qna
18:49:27FromDiscord<Hourglass [She/Her]> Uh what
18:49:39FromDiscord<Hourglass [She/Her]> now 1.6.10 refc is having the same issue
18:49:50FromDiscord<Hourglass [She/Her]> I'm... So confused
18:50:02FromDiscord<Phil> You're on linux?
18:50:06FromDiscord<Hourglass [She/Her]> Yeah
18:50:34FromDiscord<Phil> Clean out your cache and try again, just brutally rm-r ~/.cache/nim/
18:50:48FromDiscord<Phil> Repeat the compile, but clear out the cache in between each run
18:51:02FromDiscord<Phil> (edit) "compile," => "4 compile checks,"
18:53:16FromDiscord<Hourglass [She/Her]> Okay they all have the same issue
18:53:30FromDiscord<Hourglass [She/Her]> Btw im using nimble test to run the examples
18:53:39FromDiscord<Hourglass [She/Her]> tests
18:54:06FromDiscord<Hourglass [She/Her]> nim c has the same issue anyway
18:54:07FromDiscord<Hourglass [She/Her]> So odd
18:54:49FromDiscord<Phil> Okay so not necessarily a memory management issue
18:55:02FromDiscord<Hourglass [She/Her]> Doesn't seem to be
18:55:33FromDiscord<Phil> My personal guess is that it doesn't like the type declarations
18:55:42FromDiscord<Hourglass [She/Her]> In my code?
18:55:52FromDiscord<Phil> Yeah, due to those using the async pragma or something
18:56:55FromDiscord<Phil> Since macros are often the basis for pragmas , that's my current bet
18:56:59FromDiscord<Hourglass [She/Her]> I'm not even calling the async version of those procs which is weird as hell, since I'm using the stream-based API, not touching the sockets
18:57:35FromDiscord<Phil> It may just be objecting to using the async pragma with that particular set of code
18:57:42FromDiscord<Phil> (edit) "set of code" => "type definition"
18:57:49FromDiscord<Hourglass [She/Her]> Though... `proc readVarNum[R: int32 | int64](s: AsyncSocket): Future[R] {.async.} =`
18:57:56FromDiscord<Hourglass [She/Her]> Maybe that's the issue
18:58:02FromDiscord<Hourglass [She/Her]> `Future[R]`
19:00:43FromDiscord<Phil> A generic classified only by its output being generic seems fishy either way
19:01:42FromDiscord<Hourglass [She/Her]> Same issue after I separated the int32 and int64 code into separate procs
19:02:05FromDiscord<Hourglass [She/Her]> wait
19:03:28FromDiscord<Hourglass [She/Her]> Fixed!
19:03:42FromDiscord<Hourglass [She/Her]> A pain but it works again!
19:17:43FromDiscord<Phil> ?
19:17:47FromDiscord<Phil> What was the issue?
19:18:01FromDiscord<Phil> And is it the kind of thing you would've loved to have seen on SO ? 😛
19:21:46FromDiscord<Hourglass [She/Her]> In reply to @Isofruit "What was the issue?": No idea, that's the thing
19:22:02FromDiscord<Hourglass [She/Her]> I just fiddled a bit
19:22:07FromDiscord<Hourglass [She/Her]> And it worked :p
20:16:02*Notxor joined #nim
20:28:17FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4qnr
20:30:11FromDiscord<Phil> I'm not quite sure, what does this represent?
20:30:32FromDiscord<Phil> Vaguely smells like it'd be represented via object variant
20:30:59FromDiscord<4zv4l> well I don't know much Rust↵but it seems like a mix between an enum and an union
20:34:29NimEventerNew question by Francesco: unable to share a proc between two classes, see https://stackoverflow.com/questions/75689752/unable-to-share-a-proc-between-two-classes
20:38:32FromDiscord<Nycto> I’m trying to create a proc with the same name as a type I’ve defined. My goal is to create a method that converts to the type from another type in the same style as other Nim conversions (`foo.uint` for example). But the compiler is complaining about conflicting names. Is there any way around this? Example of what I’m trying to do: https://play.nim-lang.org/#ix=4qns
20:39:34Amun-Raiirc no
20:42:15FromDiscord<Nycto> Ah, bummer. But thanks!
20:42:27Amun-RaNycto: I'm (ab)using this convention: 'https://play.nim-lang.org/#ix=4qnv'
20:43:32Amun-Raif you use when you can change color: LCDColor to color: static[LCDColor] for clarity
20:44:21Amun-Raas in 'https://play.nim-lang.org/#ix=4qnx'
20:49:49FromDiscord<4zv4l> In reply to @Isofruit "I'm not quite sure,": really did the trick !
20:50:00FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4qny
20:51:12FromDiscord<4zv4l> this was the rust code
20:51:13FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4qnz
20:51:29FromDiscord<4zv4l> (edit) "https://play.nim-lang.org/#ix=4qnz" => "https://play.nim-lang.org/#ix=4qnA"
20:53:37FromDiscord<Phil> I feel like that just reinvents optionals tbh.↵A more interesting example I think would be if the enum had like 5 different types
20:53:46FromDiscord<Phil> (edit) "I feel like that ... just" added "particular case"
20:54:37FromDiscord<Phil> But nice to see the code!↵Seems more legible to me in nim, though chances are that's because I have much more nim experience nowadays than Rust
20:55:30FromDiscord<4zv4l> I honestly prefer Nim so much↵it may be less safe but↵so much easier to interact with C, winapi and handle memory manually or gb or reference counting↵so much possibility and the code is easy to read and fast to learn
20:55:43Amun-Rareadability isn't one of rust traits
20:56:03FromDiscord<4zv4l> making the project for my company, I really realized I couldn't have chosen a better language for that job
20:59:25FromDiscord<Phil> In reply to @4zv4l "I honestly prefer Nim": I mean, even that "less safe" bit means you're using `cast`, `ptr` or other things that would normally ring a bell
20:59:58FromDiscord<Phil> And no amount of holy magic can prevent you from getting a nilpointer when you expect a lib to contain a proc and then it turns out it doesn't
21:01:49FromDiscord<4zv4l> In reply to @Isofruit "I feel like that": indeed, just saw the `std/options` lib
21:02:05FromDiscord<4zv4l> but since they didn't import anything in the Rust code, wanted to make it in raw Nim too
21:02:18FromDiscord<Phil> Fair point!
21:04:01FromDiscord<4zv4l> I was afraid about memory usage but it seems the rust one allocate multiple (20) times, in total `3.2kb`↵meanwhile nim allocate only once `1kb`
21:05:56FromDiscord<Takemichi Hanagaki> sent a code paste, see https://play.nim-lang.org/#ix=4qnD
21:11:15FromDiscord<Nerve> In reply to @Amun-Ra "readability isn't one of": Having moved a Rust project to Nim for my employer, I can speak to this directly. A good half of Rust code is dedicated to massaging the borrow checker, and the business logic gets completely lost. Meanwhile I have a hard time finding any parts of my Nim project that aren't business logic.
21:11:40FromDiscord<Phil> In reply to @Nerve "Having moved a Rust": Oh no! Your precious technical details that got lost!
21:11:50*nmz- joined #nim
21:11:51FromDiscord<Nerve> whatever shall I do
21:11:55*nmz- left #nim (Ploop)
21:12:04FromDiscord<Phil> All this spare free time you now suddenly have
21:12:38FromDiscord<Nerve> I mean, all of my roadblocks now have been either deciding on how to structure my business logic, or interfacing with C libraries.
21:13:23FromDiscord<Phil> one of those is one of software-dev's general big questions, the other is one of software dev's general big language problems
21:14:11FromDiscord<Nerve> Yes, but crucially, none of that brainspace is spent on memory semantics, nor do I have to parse through oodles of memory semantics while scrolling my code
21:14:14FromDiscord<Odi> In reply to @Elegantbeef "With `-d:release` on my": Thank you for your follow up:D i will test your code<3
21:14:17FromDiscord<Phil> I guess nim makes structuring that somewhat "clearer" since you don't really have a choice to do "proper" OO
21:14:26FromDiscord<Odi> In reply to @albassort "this is the same": Thank you for your answer, it was kind=)
21:14:27FromDiscord<Phil> So your choice of going "full OO" isn't there
21:14:43FromDiscord<Phil> Which leaves you with procedural with some OO flavour here or there
21:15:06FromDiscord<Nerve> I come from the functional world so I avoid highly referential OO anyways, most of my work is on the stack, in pure functions, no refs
21:16:07FromDiscord<Nerve> You have to use them to get variant objects, but it doesn't ever become a problem because the variant type contains the ref
21:16:16FromDiscord<Nerve> (edit) "them" => "refs"
21:17:55FromDiscord<Nerve> Moving from the functional world to Nim is remarkably easy given Nim's preferences, unlike Python which has a lot of reference-type footguns
21:28:25FromDiscord<Elegantbeef> Yes move the `var` to `container: var seq[Value]`↵(@Takemichi Hanagaki)
21:28:50FromDiscord<Livid> Is there a way to mark an object that contains a reference to decrement the references ref count?
21:29:24FromDiscord<Elegantbeef> Why do you need to?
21:29:58FromDiscord<Livid> I'm trying to make a dynamic array that doesn't have a type, but rather a data size (yes, this is very unsafe), but when I remove an item (where the type is an object that contains a ref to something else) and there is no other references to the GC'd object, it is not free'd.
21:30:28FromDiscord<Elegantbeef> You want to use destructors then
21:32:15FromDiscord<Phil> Beef! Did you know that owlkettle had an {.internal.} pragma?
21:32:29FromDiscord<Elegantbeef> Should i have?
21:32:40FromDiscord<Phil> If you used setters it'd be recommendable to use it
21:34:08FromDiscord<Phil> Because if you use setters, then you generally want users to assign to the setter instead of the field that the setter forwards the value to
21:34:21FromDiscord<Phil> And with {.internal.} you can hide the field from the docs
21:34:41FromDiscord<Takemichi Hanagaki> In reply to @Elegantbeef "Yes move the `var`": Ohh, my bad! It was a misstyping...↵I'm using as you suggest me.↵But, how can I define when use var or non-var version?
21:35:02FromDiscord<Elegantbeef> When you use a var it calls the var version
21:35:08FromDiscord<Livid> In reply to @Elegantbeef "You want to use": Does that mean to always call `=destroy`? Because wouldn't that always free, rather than decrement the reference count? Or how would I just decrement the count?
21:35:09FromDiscord<Elegantbeef> when you use a non var it uses the nonvar version
21:35:36FromDiscord<Elegantbeef> Ref's `=destroy` properly does a decrement ref count and only frees if it's the last ref in a non cyclic tree↵(@Livid)
21:36:06FromDiscord<Takemichi Hanagaki> In reply to @Elegantbeef "when you use a": Hummmm, got it!↵Thank you!
21:37:17FromDiscord<Elegantbeef> Livid you might want to do something like https://github.com/beef331/traitor/blob/traitor1/traitor.nim#L5-L24 and↵https://github.com/beef331/traitor/blob/traitor1/traitor.nim#L226-L230
21:40:15FromDiscord<Odi> In reply to @Elegantbeef "With `-d:release` on my": Tested and validated, when i added -d:release --m:orc (i am using the zig compiler so the -d:lto flag is not supported yet) i get a speed of 3.53 second. Thank you, mye delicous Beef👍
21:40:58FromDiscord<Elegantbeef> Then you might even get sub 3 seconds with my variant! 😄
21:41:24FromDiscord<Takemichi Hanagaki> In reply to @Elegantbeef "when you use a": Is there a way to turn a `var` into a `let` without change the value?
21:42:25FromDiscord<Takemichi Hanagaki> In reply to @Takemichi Hanagaki "Is there a way": I don't want to copy my sequence and have one more.
21:42:40FromDiscord<Takemichi Hanagaki> (edit) "sequence" => "`seq`"
21:42:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qnJ
21:43:09FromDiscord<Elegantbeef> `lent` is a read only reference, so it does not copy if consumed directly
21:43:20FromDiscord<Takemichi Hanagaki> sent a code paste, see https://play.nim-lang.org/#ix=4qnL
21:43:43FromDiscord<Takemichi Hanagaki> In reply to @Elegantbeef "`lent` is a read": It's exactly what I was looking for. Thank you!!!!!! 🤩
21:44:04FromDiscord<Elegantbeef> I guess that should technically be a `t: var T): lent T`
21:46:08arkanoidI'm quite confused. I've always launched async proc with asynccheck, or waitfor, of just awaiting it, or grabbing the future and yelding on it. But now I've accidentally discarded it like "discard myasincproc()" and it executed normally. What's the difference from discarding it and asynccheck'ing it?
21:51:09FromDiscord<Elegantbeef> All i know is you never should discard a future that you care about
21:55:47*advesperacit quit ()
22:49:02FromDiscord<gnu> hi!
22:50:46FromDiscord<Elegantbeef> Hello
22:54:18FromDiscord<Nilts> how do threads in nim access other procs if they have their own mem
22:56:11FromDiscord<Elegantbeef> Procs are not thread local
23:06:00FromDiscord<Nilts> what does that mean? I am trying to re-create threads in a different context, and need to know the workings.
23:06:23FromDiscord<Elegantbeef> Procedures are in static memory, that is not local to a thread
23:06:56FromDiscord<Elegantbeef> with refc the heap is thread local, but with arc/orc the heap is not
23:13:12*rockcavera quit (Remote host closed the connection)
23:13:32*rockcavera joined #nim
23:15:45arkanoidElegantbeef, the point is that it seems the mere existance of a future makes it spin into the event loop
23:17:12arkanoidasyncCheck makes your program fails if that future fails in the background, but it's not in charge of making it spin into the event loop
23:27:45FromDiscord<jmgomez> IIRC asyncCheck adds a stacktrace to the future
23:28:12FromDiscord<jmgomez> and make it raise
23:38:22FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4qob
23:39:09FromDiscord<Graveflo> (edit) "https://play.nim-lang.org/#ix=4qob" => "https://play.nim-lang.org/#ix=4qoc"
23:45:20FromDiscord<Elegantbeef> cause you do not have `:=` called until the finally
23:46:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qod
23:50:56FromDiscord<Graveflo> Thanks alot! that does work, but it calls into question my understanding of how the template works. The only difference I see is that `s` is referenced before `body` in your example. Does nim not bother "evaluating" the expression until its needed? Surely this must be a semantic that is exclusive to templates since procs and the like would need the parameters up front.
23:51:42FromDiscord<Elegantbeef> templates paste the expression of the parameters where they're used
23:51:45FromDiscord<Elegantbeef> They're lazily evaluated
23:52:36FromDiscord<Elegantbeef> Templates are code subsitution
23:54:04FromDiscord<Graveflo> right I realized how bad the "evaluated" sentiment was both while I was writing it and afterward. It makes sense that the template can do formatting stuff like that. It just wasn't obvious at first. Great info though. much appreciated
23:57:27*Notxor quit (Quit: Leaving)