<< 10-02-2025 >>

00:23:53FromDiscord<bendugo> In reply to @ricky._.spanish "anyone know where the": spanish?
00:24:01FromDiscord<bendugo> maybe you'll find this useful
00:24:02FromDiscord<bendugo> https://nim-lang.org/1.0.6/gc.html
00:32:38FromDiscord<zumi.dxy> That's for `--mm:refc` though
00:33:14FromDiscord<zumi.dxy> that being said there could've been more here https://nim-lang.org/docs/mm.html
01:50:20*tiorock joined #nim
01:50:20*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
01:50:20*tiorock is now known as rockcavera
01:52:27*tiorock joined #nim
01:52:27*rockcavera is now known as Guest2812
01:52:27*Guest2812 quit (Killed (tantalum.libera.chat (Nickname regained by services)))
01:52:27*tiorock is now known as rockcavera
02:28:51FromDiscord<janakali> sent a code paste, see https://play.nim-lang.org/#pasty=OTUFpFXb
02:30:26FromDiscord<janakali> In reply to @sys64 "but seems it doesn't": ^ @System64 ~ Flandre Scarlet
03:19:22FromDiscord<fl4shk> on second thought, it seems I can't examine generic arguments of a function
03:19:34FromDiscord<fl4shk> wait... I can
03:19:39FromDiscord<fl4shk> I just realized I can
03:20:05FromDiscord<fl4shk> at least, I can do it better when I'm I not tied
03:20:08FromDiscord<fl4shk> tired
03:20:32FromDiscord<fl4shk> or not
03:20:37FromDiscord<fl4shk> seems I need macros after all
03:58:07FromDiscord<fl4shk> it's... possible to do this if a function takes arguments
03:59:28FromDiscord<fl4shk> but I can't see the generics directly
03:59:44FromDiscord<fl4shk> (edit) "but I can't see the generics ... directly" added "of the function call"
03:59:51FromDiscord<fl4shk> more investigation is needed
04:41:25*rockcavera quit (Remote host closed the connection)
06:31:35*ntat joined #nim
07:12:07FromDiscord<xtrayambak> Is there a way to set the kind of an ADT after it has been allocated using a custom allocation function?
07:19:46FromDiscord<Elegantbeef> I do still love that people call tagged unions ADTs is it's such a pointless term
07:19:47FromDiscord<Elegantbeef> Objects and tuples are by definition ADTs but for some reason they only ever mean tagged unions
07:20:53FromDiscord<xtrayambak> In reply to @Elegantbeef "I do still love": I just call em that because it's a shorthand
07:21:18FromDiscord<Elegantbeef> Oh I see my link didn't come through
07:21:20FromDiscord<xtrayambak> (edit) "a shorthand" => "shorter"
07:21:20FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-cast-uncheckedassign
07:21:38FromDiscord<xtrayambak> Thanks
07:23:21FromDiscord<xtrayambak> Huh, I still get the same error
07:23:40FromDiscord<Elegantbeef> Was there an error I missed?
07:23:49FromDiscord<xtrayambak> sent a code paste, see https://play.nim-lang.org/#pasty=pgzCGtFG
07:23:52FromDiscord<xtrayambak> sent a code paste, see https://play.nim-lang.org/#pasty=BwvQZJYz
07:23:57FromDiscord<xtrayambak> This is the error I got before and after that
07:24:03FromDiscord<xtrayambak> (edit) "and" => "_and_"
07:24:13FromDiscord<Elegantbeef> That's unrelated to the kind
07:24:32FromDiscord<Elegantbeef> That's not Nim erroring that's bali's vm
07:24:40FromDiscord<xtrayambak> Ah
07:24:58FromDiscord<xtrayambak> I should learn to read
07:24:59FromDiscord<Elegantbeef> You have a custom destructor and it's not liking it
07:25:10FromDiscord<xtrayambak> yep, removing the destructor fixes it
07:25:16FromDiscord<Elegantbeef> Also is `MAtom` even right?
07:25:28FromDiscord<xtrayambak> In reply to @Elegantbeef "Also is `MAtom` even": It should be `ptr MAtom`
07:25:29FromDiscord<xtrayambak> I think
07:25:41FromDiscord<Elegantbeef> Probably
07:26:46FromDiscord<xtrayambak> oh lord my garbage collector entered an infinite loop
07:26:47FromDiscord<xtrayambak> I love my life
07:29:55FromDiscord<Elegantbeef> Just don't make cycles
07:30:15FromDiscord<xtrayambak> No, it isn't Nim, it's my own crappy one I'm writing
07:30:27FromDiscord<Elegantbeef> Did I stutter?
07:33:40FromDiscord<xtrayambak> In reply to @Elegantbeef "Did I stutter?": Haha it isn't due to cycles, it did that because some unrelated pre-VM initialization code tried to allocate using the GC
07:33:55FromDiscord<xtrayambak> (edit) "cycles," => "cycles (yet),"
07:44:54FromDiscord<System64 ~ Flandre Scarlet> In reply to @janakali "^ <@380360389377916939>": Oh I have to use the old gc?
07:50:16FromDiscord<janakali> In reply to @sys64 "Oh I have to": yep, see https://github.com/nim-lang/Nim/issues/21446
07:54:21FromDiscord<janakali> oh just found that Arc/Orc works with `-d:useMalloc` https://github.com/nim-lang/Nim/issues/22392
08:02:43FromDiscord<System64 ~ Flandre Scarlet> In reply to @janakali "oh just found that": Oh, I can do this!↵Will it make my iteration cycles faster?
08:05:28*ntat quit (Quit: Leaving)
11:24:21FromDiscord<pmunch> Has Nim gotten more lenient about what you can use as names for stuff?
11:35:11*coldfeet joined #nim
12:02:17*coldfeet quit (Quit: Lost terminal)
13:15:30FromDiscord<Robyn [She/Her]> In reply to @pmunch "Has Nim gotten more": not afaik, why?
13:19:28FromDiscord<pmunch> Just faced some confusing issues
13:19:39FromDiscord<Robyn [She/Her]> wweird
13:38:38FromDiscord<pmunch> In a Nimble test, is there any way to specify extra command line arguments?
15:06:48FromDiscord<bostonboston> In reply to @pmunch "In a Nimble test,": You can "overload" the test task
15:07:31FromDiscord<bostonboston> https://nim-lang.github.io/nimble/create-packages.html#nimble-test
16:00:37FromDiscord<bostonboston> Alternatively, if you're referring to runtime args and don't mind every test file getting the same args then `nimble test yourArg` passes yourArg as a command line param
16:03:19FromDiscord<pmunch> I didn't want to completely redo the testing system though..
16:03:48FromDiscord<pmunch> Ended up just creating a .nims file with the same name as the test which seems to work fine
16:28:04FromDiscord<firasuke> what's the accepted way to run a proc on program exit? say removing a lock file? does wrapping the entire execution block by `try:` and `finally:` make sense here?
16:29:25FromDiscord<bostonboston> std/exitprocs
16:33:08FromDiscord<firasuke> In reply to @bostonboston "std/exitprocs": does it handle cases where the program might panic or throws an exception?
16:35:08FromDiscord<bostonboston> I don't believe ao
16:35:12FromDiscord<bostonboston> (edit) "ao" => "so"
16:36:01FromDiscord<firasuke> sigh
16:37:00FromDiscord<firasuke> I am trying to create a simple locking mechanism for a program where a lock file is created when the program is run, and the lock file has to be removed when the program exits (be it whether it exits successfully or it throws an exception or if it panics or if it gets interrupted)..
16:41:34FromDiscord<firasuke> would a defer work here?
16:45:46FromDiscord<bostonboston> I don't think it would in all cases, for example of out of mem is raised quit is used, which bypasses all control flow
16:46:21FromDiscord<bostonboston> There is the outofmemhook, but I don't know if there are other weird cases
16:48:35FromDiscord<firasuke> hmm would signal handlers work then?
17:08:27FromDiscord<bostonboston> I can't confidently answer.↵↵Maybe you could make a PR that adds a customer handler to the setTerminate handler in excpt.nim
17:09:04FromDiscord<bostonboston> Custom handler
17:28:33FromDiscord<firasuke> ok thanks
17:48:49*pbsds35 quit (Ping timeout: 268 seconds)
17:57:39*coldfeet joined #nim
18:01:34FromDiscord<determiedmech1> Hi guys quick question
18:01:45FromDiscord<determiedmech1> I was looking at some pragma stuff
18:02:04FromDiscord<determiedmech1> sent a code paste, see https://play.nim-lang.org/#pasty=LORIxnEO
18:02:28FromDiscord<determiedmech1> what is the `procedure[^1].add(...)`?
18:02:44FromDiscord<determiedmech1> https://forum.nim-lang.org/t/11370
18:06:31FromDiscord<lainlaylie> the last node in a nnkprocdef is the body
18:16:34FromDiscord<determiedmech1> ah
18:16:45FromDiscord<determiedmech1> Wait is this stuff documented in macros
18:18:21FromDiscord<determiedmech1> oooh so does `quote do:` return AST?
18:19:05FromDiscord<determiedmech1> aaaahhhhh
18:31:40FromDiscord<lainlaylie> In reply to @determiedmech1 "Wait is this stuff": yes its all in https://nim-lang.org/docs/macros.html
18:34:45FromDiscord<fl4shk> I've been doing macro stuff too
18:37:35FromDiscord<fl4shk> is there any way to get the definition of a `proc` that takes generics, just with the generics expanded?
18:44:31FromDiscord<fl4shk> from within a macro, I mean
18:45:46*pbsds35 joined #nim
18:46:51FromDiscord<fl4shk> maybe I need untyped macros
18:48:02FromDiscord<fl4shk> those don't appear to be the right answer
18:49:00FromDiscord<fl4shk> guess I'll have to do type substitution myself somehow
18:51:53*coldfeet quit (Quit: Lost terminal)
18:52:05*alice left #nim (#nim)
19:09:50FromDiscord<threefour> Is there any way to know the size of a table built from the table constructor, and use that in a type definition at compile-time?
19:13:18FromDiscord<Elegantbeef> `len({...})`
19:21:05*ntat joined #nim
19:34:24FromDiscord<fl4shk> okay I finally got generics mostly working!
19:34:30FromDiscord<fl4shk> for function calls at least
19:48:05*ntat_ joined #nim
19:48:15*ntat quit (Ping timeout: 260 seconds)
20:06:48FromDiscord<xenon_tech> Hello!
20:21:45FromDiscord<xenon_tech> Um, why am I getting this error? https://media.discordapp.net/attachments/371759389889003532/1338605851417645197/image.png?ex=67abb159&is=67aa5fd9&hm=437a86fce59e2a3328d761c2efc46ff30bb3d250bab6448c9ea6bb26f855da45&
20:22:14FromDiscord<Elegantbeef> You don't have gcc in your path
20:23:12FromDiscord<xenon_tech> In reply to @Elegantbeef "You don't have gcc": Oh, how to get it?
20:23:48FromDiscord<Elegantbeef> Install gcc and add it to the environmental variable
20:23:57FromDiscord<xenon_tech> Ok
20:42:33FromDiscord<xenon_tech> In reply to @Elegantbeef "Install gcc and add": Are you real
20:43:45FromDiscord<Elegantbeef> My parents told me I was
20:43:51FromDiscord<Elegantbeef> That is in the past so who knows now
20:44:59*lumidify quit (Quit: leaving)
20:45:03FromDiscord<xenon_tech> In reply to @Elegantbeef "That is in the": 🧐 💀
20:46:08*lumidify joined #nim
20:46:23FromDiscord<determiedmech1> oh yeah I had a question about cross compiling
20:47:01FromDiscord<determiedmech1> https://cdn.discordapp.com/attachments/1133080287824334878/1337858985667067955/image.png?ex=67ab9cc6&is=67aa4b46&hm=022ebb555ac6b6f37a11b847e8284810bbf66664276a0c246b8cbb9feafe74e5&↵This happens when I use --os:windows -d:MingW64
20:47:10FromDiscord<determiedmech1> whatever the flags in the example are
20:47:16FromDiscord<Elegantbeef> Are you on Linux?
20:47:17FromDiscord<determiedmech1> embed fail 😭
20:47:21FromDiscord<determiedmech1> In reply to @Elegantbeef "Are you on Linux?": Yes
20:47:31FromDiscord<Elegantbeef> `-d:mingw` is all you need
20:47:40FromDiscord<determiedmech1> ah ok
20:47:57FromDiscord<determiedmech1> This is what was happening https://media.discordapp.net/attachments/371759389889003532/1338612441411751977/image.png?ex=67abb77c&is=67aa65fc&hm=491e3856937cde6b12d65bdc10885dd0aca7f05f9bdef03c81d541f9ec62bb88&
20:50:41FromDiscord<Elegantbeef> Was or is?
20:51:47FromDiscord<xenon_tech> Can you make a game with Nim?
20:52:18FromDiscord<Elegantbeef> It's a Turing complete language you can make anything
20:53:05*ntat_ quit (Quit: Leaving)
20:53:15FromDiscord<solitudesf> In reply to @xenon_tech "Can you make a": no, i cant...
20:53:18FromDiscord<determiedmech1> In reply to @Elegantbeef "Was or is?": I'll try again later and send a screenshot
20:53:25FromDiscord<xenon_tech> In reply to @solitudesf "no, i cant...": Why
20:53:28FromDiscord<determiedmech1> can't rn 😞
20:53:36FromDiscord<Elegantbeef> Solitude giving the real answers
20:53:49FromDiscord<determiedmech1> actually I can see if it works on my phone if I can get mingw in termux
20:54:17FromDiscord<Elegantbeef> I don't imagine mingw will be in termux
20:54:24FromDiscord<Elegantbeef> Who is cross compiling on termux to windows
20:57:06FromDiscord<bendugo> anyone know if the front end for nimble.directory is open source?
20:58:37FromDiscord<Elegantbeef> https://github.com/FedericoCeratto/nim-package-directory
21:02:08FromDiscord<determiedmech1> It actually doesn't fun fact
21:02:18FromDiscord<michaelb.eth> he archived it back in Aug... is he also hosting it, or maybe it's a gh-pages thing, I never looked very closely
21:02:26FromDiscord<determiedmech1> In reply to @Elegantbeef "Who is cross compiling": some llvm stuff is
21:03:37FromDiscord<determiedmech1> https://media.discordapp.net/attachments/371759389889003532/1338616384867008512/image0.jpg?ex=67abbb28&is=67aa69a8&hm=4647a8bcd8ca1fe398127f24dca8da0a73bc7774039ef80f3d69b54fed500228&
21:03:53FromDiscord<determiedmech1> but that's llvm
21:03:59FromDiscord<determiedmech1> 😔
21:33:04*rockcavera joined #nim
22:13:06FromDiscord<System64 ~ Flandre Scarlet> Hi! Is there a library that let me serialize (and save to file) stuff with key-value pairs, so I can extend my objects without worrying about versionning please?↵I avoid JSON because values are text.
22:36:45FromDiscord<Elegantbeef> Messagepack or if you're adventurous https://github.com/beef331/vsbf
22:38:59FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Messagepack or if you're": Does Messagepack let me iterate through values? and writing values individually while keeping key-value pairs?
22:39:35FromDiscord<Elegantbeef> It's practically a binary json variant
22:40:30FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=OyKrTuFY
22:40:58FromDiscord<System64 ~ Flandre Scarlet> I use msgpack4nim
22:43:28FromDiscord<Elegantbeef> vsbf does store the field names in the binary
22:43:39FromDiscord<Elegantbeef> So if that's something you want consider being adventurous and being my first customer
22:46:14FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "So if that's something": Gotta give it a try!↵But what happens if I add a new field to the object and I try to load an old version of this object?
22:46:35FromDiscord<Elegantbeef> It stores the field names so it works just like json
22:47:04FromDiscord<Elegantbeef> It's a versionless format that allows easish migration as fields are typed and you can write hooks for specific types
22:59:44FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It's a versionless format": I tested quickly, and seems robust and doesn't fail when I add new fields!↵However it seems I can't set a default value up? And how would it act with inheritence?
23:00:12FromDiscord<Elegantbeef> It doesn't work with inheritance as that loses type information
23:00:16FromDiscord<Elegantbeef> "set a default value up"?
23:01:04FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef ""set a default value": Yeah↵Because if I add a new field, it is automatically set to 0, but maybe I want something else
23:02:21FromDiscord<Elegantbeef> Can you not just use the type level defaults?
23:02:49FromDiscord<System64 ~ Flandre Scarlet> Nope, doesn't work
23:03:29FromDiscord<Elegantbeef> huh
23:13:16FromDiscord<Elegantbeef> Well thanks, bug found and eliminated
23:13:18FromDiscord<Elegantbeef> https://github.com/beef331/vsbf/blob/master/tests/tbasics.nim#L42-L55 Just to ensure you're doing the same
23:15:43FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "https://github.com/beef331/vsbf/blob/master/tests/t": It works! Thanks!
23:28:36FromDiscord<System64 ~ Flandre Scarlet> However, is it normal that I have vsbf as header and not the type name?
23:31:48FromDiscord<Elegantbeef> Yes
23:32:09FromDiscord<Elegantbeef> I'm uncertain what you mean though, but only the file starts with vsbf
23:32:42FromDiscord<Elegantbeef> The type is a single byte with the last reserved for "type name follows this"
23:33:55FromDiscord<Elegantbeef> So for an `tuple[a, b: int]` you should have like `vsbf Version1 Version0 Struct Int 1 'a' IntValue Int 1 'b' IntValue`
23:34:43FromDiscord<Elegantbeef> If that's not the way the file is written I seemed to have messed up majorly and have no clue how 😄
23:35:09FromDiscord<Elegantbeef> Oh I left out the `StructEnd`
23:35:24FromDiscord<Elegantbeef> That should be the last byte of every vsbf file
23:35:56FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=PgaGRyIo
23:37:36FromDiscord<Elegantbeef> every vsbf struct\
23:37:37FromDiscord<Elegantbeef> Are you using the proper vsbf?
23:38:18FromDiscord<System64 ~ Flandre Scarlet> Yes
23:39:41FromDiscord<fl4shk> can someone tell me how to correctly use `ptr` types in Nim
23:39:52FromDiscord<Elegantbeef> If you need to ask you don't need them
23:40:00FromDiscord<fl4shk> I understand pointers in C++
23:40:03FromDiscord<fl4shk> already
23:40:13FromDiscord<Elegantbeef> Then you understand pointers in Nim
23:40:15FromDiscord<fl4shk> I'm getting an error from attempting to dereference a `ptr`
23:40:40FromDiscord<fl4shk> sent a code paste, see https://play.nim-lang.org/#pasty=XeEQZkxG
23:40:56FromDiscord<Elegantbeef> You hit a compiler error so you're probably using pointers in the VM
23:41:01FromDiscord<fl4shk> oh gotcha, probably, yeah
23:41:05FromDiscord<fl4shk> these are in macros
23:41:09FromDiscord<Elegantbeef> Use `ref T` instead
23:41:13FromDiscord<fl4shk> good enough for me
23:44:15FromDiscord<Elegantbeef> It's so odd System
23:44:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=eQevlsME
23:44:36FromDiscord<Elegantbeef> Like it's clearly being saved right, but seems like a Nim bug has crept in
23:45:27FromDiscord<System64 ~ Flandre Scarlet> OOF!!
23:45:37FromDiscord<System64 ~ Flandre Scarlet> I found a language bug
23:45:39FromDiscord<Elegantbeef> Oh I think I found the bug
23:54:21*jkl quit (Excess Flood)
23:54:55*jkl joined #nim
23:56:41FromDiscord<Elegantbeef> Well sorry about that @System64 ~ Flandre Scarlet but hopefully that's the last bug. I swear I tested this!
23:56:58FromDiscord<Elegantbeef> I just never tested it with inheritance or defaults cause I don't use them as I mostly use object variants
23:59:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "I just never tested": It works! Thanks!↵However doesn't work with Ref Objects sadly (it is a compilation error)