<< 13-04-2025 >>

00:15:04*pbsds35 quit (Ping timeout: 244 seconds)
00:16:09*pbsds35 joined #nim
01:24:57*derpydoo joined #nim
02:14:08*beholders_eye quit (Ping timeout: 252 seconds)
05:02:41*amadaluzia quit (Ping timeout: 268 seconds)
05:28:34*amadaluzia joined #nim
05:34:00*amadaluzia quit (Ping timeout: 260 seconds)
06:25:34*coldfeet joined #nim
06:49:46FromDiscord<pmunch> In reply to @fabric.input_output "<@392962235737047041> I tried this": Unfortunately you can't use define like that. It just does C defines. `nodeclguards` and `exportall` must be defined the Nim way
06:50:51*ensyde joined #nim
06:52:39*ntat joined #nim
09:04:48*om3ga quit (Ping timeout: 252 seconds)
09:44:39*derpydoo quit (Quit: derpydoo)
09:51:39*flynn quit (Ping timeout: 245 seconds)
09:54:38*ntat quit (Quit: leaving)
11:35:54*ensyde quit (Quit: WeeChat 4.6.0)
11:47:36*MrGoblins quit (Read error: Connection reset by peer)
11:47:44*MrGoblins joined #nim
11:56:17*beholders_eye joined #nim
11:59:39*MrGoblins quit (Ping timeout: 265 seconds)
12:02:42*coldfeet quit (Quit: Lost terminal)
12:10:21*beholders_eye quit (Quit: WeeChat 4.5.1)
13:02:49FromDiscord<joae> How do you covert custom type to bytes and back?
13:03:06FromDiscord<joae> (edit) "covert" => "convert"
13:03:07*pmp-p quit (Ping timeout: 252 seconds)
13:03:38*andy-turner joined #nim
13:19:43*MrGoblins joined #nim
13:38:02FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=wAJoKAcA
13:38:48FromDiscord<aintea> (edit) "https://play.nim-lang.org/#pasty=gCjtkRtm" => "https://play.nim-lang.org/#pasty=VIHVYhcg"
13:40:50FromDiscord<heysokam> In reply to @joae "Bunch of questions: 1.": 2. Not nim-only. But there are good bindings to gtk and qt. And you can generate bindings to any other C lib with futhark↵3. Are you using the one from `nim-lang.org`? there are a few, but that one has almost no downloads (its recent) and its the official one in reality. The others are out of date
13:41:35FromDiscord<heysokam> (edit) "In reply to @joae "Bunch of questions: 1.": 2. Not nim-only. But there are good bindings to ... gtkThe" added " dearimgui," | " dearimgui,gtk and qt. ... And" added "The gtk ones are pretty good."
13:43:05FromDiscord<heysokam> In reply to @aintea "After multiple months of": whats different between this and `std/options`? asking out of complete ignorance
13:45:46FromDiscord<aintea> None, it is just to make an example
13:46:08FromDiscord<aintea> Option is the simplest form of object variants so I just remade it
13:47:54FromDiscord<joae> In reply to @heysokam "2. Not nim-only. But": Which one do you recommend?
13:49:31FromDiscord<heysokam> In reply to @joae "Which one do you": haven't used any. can't recommend↵but @Phil might give you some insights, he was doing some really cool UI work some time ago
13:49:56FromDiscord<heysokam> In reply to @aintea "Option is the simplest": ah gotcha
13:50:14FromDiscord<Robyn [She/Her]> In reply to @aintea "After multiple months of": Wait I thought non-ref types degraded
13:51:18FromDiscord<Phil> In reply to @heysokam "haven't used any. can't": The GTK ones are alright, given I contributed a decent chunk to them I'm aware that you can build at least a decent amount of stuff with them.↵Sadly some of the more advanced functionality isn't wrapped because you'd need to figure out how to properly implement passing references of widget A to B and I tried and failed to do that (and can.l doesn't seem to be having the time)
13:51:33FromDiscord<heysokam> In reply to @joae "Bunch of questions: 1.": For #1, I would personally look into `treeform/binny`, to see if he solved the task already
13:52:06FromDiscord<heysokam> In reply to @isofruit "The GTK ones are": CC: @joae
13:52:46FromDiscord<Phil> But overall I'd say like 5/6ths are wrapped (including libadwaita).↵↵I can't speak for any of the other wrappers, they looked more complex to me when I tried them but maybe that's just me.↵Owlkettle at least provides a way to define your GUI declaratively which I value a lot
13:57:23FromDiscord<joae> In reply to @heysokam "For #1, I would": Isn't it part of the stdlib? Chatgpt pointed me to Marshall
13:59:54FromDiscord<heysokam> In reply to @joae "Isn't it part of": don't use chatgpt for code tips. its garbo. use sonnet 3.5, or better gemini 3.5-pro-exp (both free)
14:00:16FromDiscord<heysokam> gemini is ridiculously good right now
14:01:41FromDiscord<heysokam> In reply to @joae "Isn't it part of": about the marshall thing, I can't say. I don't know the answer↵That's why I recommended to look into binny, since treeform is really good and he did a lot of binary data serialization in that lib
14:01:45FromDiscord<joae> Hm, do you also use cursor?
14:02:05FromDiscord<heysokam> Augment for code-aware things, but Cursor for gemini yea
14:03:55FromDiscord<lainlaylie> https://nim-lang.org/docs/marshal.html
14:03:58FromDiscord<lainlaylie> > This module contains procs for serialization and deserialization of arbitrary Nim data structures. The serialization format uses JSON.
14:04:05FromDiscord<lainlaylie> doesnt sound like converting to/from bits to me
14:04:14FromDiscord<lainlaylie> (edit) "bits" => "bytes"
14:14:31FromDiscord<aintea> In reply to @battery.acid.bubblegum "Wait I thought non-ref": You're talking about fusion or just the Nim compiler ?
14:14:45FromDiscord<aintea> Because fusion is giving me error messages from the case macro
14:31:17*ntat joined #nim
14:36:17FromDiscord<griffith1deadly> In reply to @joae "Bunch of questions: 1.": from my expirience zed works better with nim extension at autocompletion and like more faster by feelings
15:08:05*xutaxkamay_ joined #nim
15:08:54*xutaxkamay quit (Ping timeout: 244 seconds)
15:10:41*xutaxkamay_ is now known as xutaxkamay
15:20:31*coldfeet joined #nim
15:23:17*xutaxkamay quit (Read error: Connection reset by peer)
15:23:30*xutaxkamay_ joined #nim
15:24:22*xutaxkamay_ is now known as xutaxkamay
15:31:21*PMunch joined #nim
15:48:11*PMunch quit (Quit: Leaving)
15:57:40*PMunch joined #nim
15:59:53*MrGoblins quit (Remote host closed the connection)
16:13:24*PMunch quit (Quit: Leaving)
16:15:57*amadaluzia joined #nim
16:32:22*coldfeet quit (Quit: leaving)
16:33:10*amadaluzia quit (Ping timeout: 260 seconds)
16:36:42*amadaluzia joined #nim
16:36:53*coldfeet joined #nim
16:41:22*n|Phreak joined #nim
16:42:57FromDiscord<Robyn [She/Her]> In reply to @aintea "You're talking about fusion": The latter
16:43:25FromDiscord<aintea> I can assure you it compiles fine
16:43:40FromDiscord<aintea> But I do remember trying this earlier this year and it was not working
16:43:47FromDiscord<aintea> Or maybe I did something different, I have no idea
16:46:58FromDiscord<Elegantbeef> @Robyn [She/Her] non ref objects do decay when you assign to a parent type, but as a parameter they're passed as a reference so you can recover the data
16:49:19*coldfeet quit (Quit: leaving)
16:49:54FromDiscord<Elegantbeef> So yes this is actually not making Rust style ADTs cause it decays when you do \`\: Option[T] = Some[T](value\: default T)
16:49:59*ftajhii quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
16:51:55FromDiscord<Elegantbeef> As a matter of fact this doesn't compile https://play.nim-lang.org/#pasty=gnnSdytN
16:52:30*coldfeet joined #nim
16:53:34FromDiscord<Elegantbeef> Whoops forgot a generic parameter 😄
16:55:53FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=zOcmJFCX there we go it compiles but it ain't right
16:56:10FromDiscord<Elegantbeef> @aintea probably interests you
16:57:50FromDiscord<aintea> In reply to @Elegantbeef "https://play.nim-lang.org/#pasty=zOcmJFCX there we ": Why isn't it right
16:59:06FromDiscord<Elegantbeef> Cause it decays to `Option[T]` which has no field `value`
16:59:19FromDiscord<Elegantbeef> As such it prints whatever is on the stack after `Option[T]`
16:59:26n|PhreakDoes anyone run nimble on FreeBSD?
16:59:46FromDiscord<Elegantbeef> This can be seen by comparing `sizeof(Option[T])` vs. `sizeof(Value[T])`
17:00:17FromDiscord<Elegantbeef> Inheritance is not a tagged union so when using the static type it takes up that size, you need to use object variants in Nim to get what you want
17:02:36n|PhreakTrying to get nimble to update packages or even install packages on FreeBSD, I run into this error https://play.nim-lang.org/#pasty=OVcXUJfG everytime, I have a cacert.pem file that is currently in /usr/bin/ but that does seem to do anything.
17:02:37*ftajhii joined #nim
17:03:13n|Phreak.//s/does/doesn't/g
17:04:21FromDiscord<Elegantbeef> I don't know BSD well but I think windows searches next to the binary so perhaps put it there
17:15:56FromDiscord<Laylie> sent a code paste, see https://play.nim-lang.org/#pasty=muzDNFUq
17:16:28n|Phreakhmm so I have it in /usr/local/nim/bin/ and ~/.nimble/ and /usr/local/bin
17:43:09FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "<@524288464422830095> non ref objects": ah gotcha
17:49:01FromDiscord<aintea> In reply to @Elegantbeef "As such it prints": OOOOH that's why
17:49:58FromDiscord<aintea> Isn't there a way to cast it to Option[T] but when casting back into a Some[T] it gets back the value field ?
18:21:39*przmk quit (Remote host closed the connection)
18:22:09*przmk joined #nim
18:32:50FromDiscord<aintea> I can't seem to pass it as a function argument as a ref
18:55:44FromDiscord<Elegantbeef> @aintea what?
18:58:37FromDiscord<aintea> You said I should be able to pass the `Some[T]` as a `ref Option[T]` then cast it back into a `ref Some[T]` to get back the fields, no ?
18:59:10FromDiscord<Elegantbeef> `ref` is heap allocated and is dumb to use when you have object variants right there
18:59:38FromDiscord<aintea> I know but I hate having to deal with a `kind` field
19:01:07FromDiscord<Elegantbeef> I don't see how you have to hate it
19:02:15FromDiscord<Elegantbeef> But if you must have to hate it
19:05:35FromDiscord<aintea> In reply to @Elegantbeef "I don't see how": It adds a field, it's really just uncomfortable to my eyes
19:06:02FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=gjUzhARI
19:06:11FromDiscord<Elegantbeef> Oh noes a hidden field 😄
19:06:47FromDiscord<leorize> I like how you created std/options with extra steps there
19:06:48FromDiscord<Elegantbeef> You of course can remove `isSome` if you really want since the type info makes it redundant
19:07:02FromDiscord<Elegantbeef> ikr
19:07:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=QaomItYO
19:07:54FromDiscord<aintea> Yeah but that doesn't exactly represent what it is
19:08:18FromDiscord<aintea> the None variant also have a field (set to the default value, yes, but a field that shouldn't exist nonetheless)
19:08:46FromDiscord<ElegantBeef> The field doesn't matter cause it's not even accessible outside of this module
19:09:07FromDiscord<ElegantBeef> https://play.nim-lang.org/#pasty=aDsfXjeZ
19:09:10FromDiscord<ElegantBeef> Even moreso now
19:09:45FromDiscord<Elegantbeef> Ah nvm cannot use distincts cause it then loses the RTTI
19:10:47FromDiscord<ElegantBeef> I do like that this shows a compiler bug though
19:11:04FromDiscord<ElegantBeef> Yet another cgen issue if you remove the `ptr` and `addr`
19:11:16*coldfeet quit (Quit: Lost terminal)
19:21:18FromDiscord<heysokam> can system typedesc names be shadowed/overloaded?↵like having a `proc string ()=` and similar
19:21:39FromDiscord<leorize> sure, they're not special at all
19:22:04FromDiscord<leorize> some macros might mess it up if they emit `ident` instead of `bindSym`, though
19:51:10FromDiscord<heysokam> hmmm, I thought I could do `thing[N]` for `const thing = {'a'..'z'}` 🤔↵how do you sample from a regular non-hashset set?
19:53:48FromDiscord<exelotl> if N is an integer then you'd do`N.char in thing`
19:53:56FromDiscord<exelotl> (edit) "do`N.char" => "do `N.char"
19:54:58FromDiscord<leorize> random sample isn't really possible for sets I think
19:55:42FromDiscord<leorize> if you only need a range and not a set, just create a `Slice[char]` and sample that
20:05:12FromDiscord<heysokam> crap 😦
20:05:18FromDiscord<heysokam> i do need sampling
20:06:15FromDiscord<leorize> convert to seq then sample
20:06:22FromDiscord<leorize> set isn't made for random access
20:07:08FromDiscord<heysokam> how does `random.sample( someSet )` work?
20:07:17FromDiscord<heysokam> it does allow sampling from sets, hmmm
20:48:08FromDiscord<leorize> the source code is open \:p
20:53:01FromDiscord<exelotl> Oh yeah sorry I misunderstood what you were asking
21:11:21*andy-turner quit (Quit: Leaving)
21:48:49*ntat quit (Quit: leaving)
22:05:48*SchweinDeBurg quit (Read error: Connection reset by peer)
22:11:05*SchweinDeBurg joined #nim
22:38:49FromDiscord<devlop_gaming> Is it safe getting the address of an object?
22:40:34FromDiscord<fabric.input_output> getting the address should be safe, the most important thing is what you do with the address afterwards
22:41:47FromDiscord<devlop_gaming> What you mean? Do I need to delete it after use or something?
22:42:51FromDiscord<fabric.input_output> no but for example if the object gets deallocated and you try to read from/write to the pointer you get undefined behavior
22:44:33FromDiscord<devlop_gaming> Oh
22:46:14FromDiscord<fabric.input_output> and undefined behavior is worse than errors
22:53:56FromDiscord<devlop_gaming> How so?
22:57:28FromDiscord<fabric.input_output> because you don't know it happened or how it may affect the program
22:57:39FromDiscord<fabric.input_output> an error simply crashes your program
22:57:48FromDiscord<fabric.input_output> undefined behavior who knows what it might cause
22:57:56FromDiscord<fabric.input_output> that's why it's called undefined
22:59:30FromDiscord<devlop_gaming> What if I do it intentionally just to see what happens 🤔
23:02:24FromDiscord<fabric.input_output> you can
23:02:32FromDiscord<fabric.input_output> but no guarantee that the same thing will happen later
23:03:09FromDiscord<leorize> you can't even guarantee that it will do the same thing if you change a random line elsewhere
23:06:31FromDiscord<fabric.input_output> true