<< 05-08-2025 >>

00:44:10*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
00:47:29*Lord_Nightmare joined #nim
00:52:02FromDiscord<heysokam> In reply to @.bobbbob "oh duh, I had": I had some of those with converters too. implicit behavior can be confusing/misleading sometimes
00:57:48*tiorock joined #nim
00:57:48*tiorock quit (Changing host)
00:57:48*tiorock joined #nim
00:57:48*rockcavera is now known as Guest5213
00:57:48*Guest5213 quit (Killed (tantalum.libera.chat (Nickname regained by services)))
00:57:48*tiorock is now known as rockcavera
00:59:54*rockcavera is now known as Guest6446
00:59:55*tiorock joined #nim
00:59:55*Guest6446 quit (Killed (tungsten.libera.chat (Nickname regained by services)))
00:59:55*tiorock is now known as rockcavera
01:43:18*shwouchk quit (Ping timeout: 276 seconds)
01:45:33*shwouchk joined #nim
02:30:39*rockcavera quit (Remote host closed the connection)
04:31:15*amadaluzia quit (Quit: ZNC 1.10.1 - https://znc.in)
05:13:05*skippy8 joined #nim
05:13:15*nils` quit (Ping timeout: 276 seconds)
06:10:00*nils` joined #nim
06:19:29*nils` quit (Ping timeout: 248 seconds)
06:50:01*skippy8 quit (Quit: WeeChat 4.6.3)
07:19:11FromDiscord<albassort> can i make two enums identified by a singular type so i can have them in a table around each other
07:20:28FromDiscord<albassort> meh i'll just make them be in the same enum
07:21:11FromDiscord<Elegantbeef> I'm curious what your question implies
07:21:22FromDiscord<Elegantbeef> > table around each other↵especially
07:21:46FromDiscord<albassort> so like
07:23:21FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=xkAhNXNU
07:23:51FromDiscord<albassort> e.g my goal is a table that accepts either enum
07:24:17FromDiscord<Elegantbeef> The bad way would be to use a converter and never expose the underlying data
07:24:23FromDiscord<Elegantbeef> The smart way would be to implement a `[]` for the table
07:25:37FromDiscord<albassort> could just make them one
07:25:48FromDiscord<albassort> but it would confuse some things
07:25:51FromDiscord<albassort> grr
07:26:22FromDiscord<albassort> think i'll just give them string forms and tell them to use $
07:26:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=iAqmhqTV
07:27:13FromDiscord<Elegantbeef> Whoops I've been told repeatedly it's `X | Y` for types
07:28:18FromDiscord<albassort> this is strange
07:28:46FromDiscord<albassort> hmm
07:29:17FromDiscord<albassort> so many ways to skin a cat sometimes
07:31:45*ntat joined #nim
07:35:20FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=dyZELwdr
07:35:28FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=zUSDvSnd" => "https://play.nim-lang.org/#pasty=hiqnCJty"
07:36:51FromDiscord<albassort> err
07:36:54FromDiscord<albassort> this has a few issues
07:37:09FromDiscord<albassort> i think i will use the concept
07:38:10FromDiscord<Elegantbeef> The concept won't help since concepts don't work at runtime
07:38:15FromDiscord<Elegantbeef> You can only have a table of a single key
07:44:11FromDiscord<albassort> i'll do a static check at compile time ot make sure the enum names line up again
07:53:13FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=RbiBpjfk
07:53:18FromDiscord<albassort> janky but works
08:12:29*nils` joined #nim
08:31:45*nils` quit (Ping timeout: 248 seconds)
09:19:13*nils` joined #nim
09:19:24Amun-RaI still use "or" instead of "|"
10:11:05FromDiscord<steamhacker_1837> I can't understand why nim baned tabs and do not divide uppercase and lowercase letter
10:11:12FromDiscord<steamhacker_1837> it's very angry syntax
10:18:53Amun-Rawhat do you mean by angry? you like snake case like me? perhaps you like cammel case more? feel free to use either of them
10:19:34Amun-Raand banning tabs is a great idea for a language that does use whitespaces for indents; one cause of errors less
10:21:23FromDiscord<lainlaylie> the syntax itself exudes an aura of rage
10:21:56Amun-Raand the case of the first letter is sensitive
10:25:11FromDiscord<janakali> I like style insensitivity, just because I don't need to remember the shape of identifiers.↵Was it toOpenArray or to_open_array or toOpenarray, maybe toOPENARRAY?↵In Nim I can just type it in lowercase and then "fix" it later. I think nph can fix the cases too. Honestly, don't remember.
10:25:21FromDiscord<janakali> good for prototyping stuff quickly
10:27:57FromDiscord<lainlaylie> what makes tabs so desirable? the ability to configure their displayed width? saving a couple bytes per line?
10:29:16Amun-Rathe only time I had to change naming because of that was during porting SDL (Event and EVENT)
10:33:02FromDiscord<steamhacker_1837> In reply to @Amun-Ra "the only time I": you ported SDL?
10:33:05FromDiscord<steamhacker_1837> version what?
10:33:21Amun-Ra1.2, 2.x and 3.x
10:33:30FromDiscord<steamhacker_1837> oh...
10:33:42Amun-Rabut those modules only work with dlopen
10:33:54FromDiscord<steamhacker_1837> what is dlopen
10:34:13Amun-RaI mean they are bound dynamically on request
10:38:20FromDiscord<steamhacker_1837> i'm now making nim-posix library with out libc by calling syscall directly with assembly.↵please give me some word about it.
10:38:51FromDiscord<steamhacker_1837> what should I consider and↵what nim need
10:49:20Amun-RaI only wrote lowlevel hello world, that's it
11:09:53*zgasma quit (Quit: Lost terminal)
11:24:35FromDiscord<albassort> can i write a pragma for types without it being a macro 🥺
11:24:47FromDiscord<albassort> i just wanna take the type at compile time and do non macro things
11:24:58FromDiscord<albassort> i still dont know how to macro
11:44:41*skippy8 joined #nim
11:49:59*xtr00 quit (Ping timeout: 240 seconds)
11:51:27*xtr00 joined #nim
12:10:19*ntat quit (Quit: Leaving)
12:12:57*ntat joined #nim
12:17:37*xtr00 quit (Ping timeout: 276 seconds)
12:20:55*xtr00 joined #nim
12:36:14*xtr00 quit (Ping timeout: 245 seconds)
12:37:00*xtr00 joined #nim
13:12:43FromDiscord<blashyrk> Passing a value object to proc with a parameter of 'var T' passes it by reference, mutably. Is there an immutable variant?
13:18:37Amun-Rano "var" before T
13:22:12FromDiscord<janakali> https://nim-lang.org/docs/manual.html#procedures-var-parameters↵> Note: var parameters are never necessary for efficient parameter passing. Since non-var parameters cannot be modified the compiler is always free to pass arguments by reference if it considers it can speed up execution.
13:24:31FromDiscord<nervecenter> In reply to @blashyrk "Passing a value object": Yeah immutable is default, var is the explicit mutable reference marker
13:25:27FromDiscord<nervecenter> If you provide a default value for an argument, you'll discover the compiler wants to make it immutable. Try providing a default value to a `var` argument and see the error the compiler throws.
13:37:13FromDiscord<blashyrk> In reply to @Amun-Ra "no "var" before T": But that just copies T
13:37:27FromDiscord<blashyrk> I don't want a copy, I want a reference 🙂
13:37:52FromDiscord<blashyrk> I can fiddle with `ptr T`/`addr T` but that's ugly and unwieldy as hell for this simple usecase
13:38:04FromDiscord<blashyrk> (edit) "I can fiddle with `ptr T`/`addr T` but that's ugly and unwieldy as hell for this simple usecase ... " added "and is also of course mutable"
13:38:09*Jhonny2x4 quit (Quit: Jhonny2x4)
13:38:50*Jhonny2x4 joined #nim
13:41:39*Jhonny2x4 quit (Client Quit)
13:41:49*Jhonny2x4 joined #nim
13:44:21FromDiscord<blashyrk> In reply to @nervecenter "Yeah immutable is default,": Copy is default, not immutable ref (or am I wrong about that)?
13:55:03FromDiscord<nervecenter> Larger values (especially dynamic heap vals using hidden pointers eg. strings and seqs) are passed by immutable ref, since if it can't be modified there's no need to copy. Ref counting is the default mm, so even if the original goes out of scope, the context it was passed to will still have the immutable reference.
13:55:13FromDiscord<nervecenter> In reply to @blashyrk "Copy is default, not": Larger values (especially dynamic heap vals using hidden pointers eg. strings and seqs) are passed by immutable ref, since if it can't be modified there's no need to copy. Ref counting is the default mm, so even if the original goes out of scope, the context it was passed to will still have the immutable reference.
13:56:01FromDiscord<nervecenter> Nim makes it kinda hard to build programs that way though and that's desirable
13:57:05FromDiscord<nervecenter> That usually means you're tangled in some jungle of object methods, and Nim discourages stateful OO
13:58:24FromDiscord<nervecenter> So most programs are going to be a pyramid of calls on the stack, and you're basically guaranteed that the called proc exists entirely within the lifetime of the caller
13:59:50FromDiscord<nervecenter> Thus the default is pass by value using immutable refs
14:00:18FromDiscord<blashyrk> But value types are copied when passed, unless the parameter is `var T` or `ptr T`?
14:00:23*amadaluzia joined #nim
14:01:01FromDiscord<nervecenter> Only small value types are copied iirc, primitives that exist within a single address (ints, floats)
14:01:19FromDiscord<nervecenter> You can alwasy ask in #internals
14:09:37FromDiscord<lainlaylie> the cutoff is 3 floats
14:09:49FromDiscord<lainlaylie> just write a little program and look at the generated C
14:28:22FromDiscord<janakali> In reply to @janakali "https://nim-lang.org/docs/manual.html#procedures-va": @blashyrk did you miss my message above? compiler passes parameters by reference (using hidden pointer) if they're big enough↵you can also enforce it by using `{.byref.}` pragma on object type or parameter: https://nim-lang.org/docs/manual.html#foreign-function-interface-byref-pragma
14:29:03FromDiscord<blashyrk> In reply to @janakali "<@148538079030935552> did you miss": Ah cool, I did indeed miss it, and the {.byref.} pragma is exactly what I was looking for 🙂 ↵Thanks @janakali @nervecenter @lainlaylie !
15:29:15*skippy8 quit (Quit: WeeChat 4.6.3)
17:23:12FromDiscord<amjadhd> What's the problem with this [code](https://play.nim-lang.org/#pasty=AccfaHCI)?
17:25:07FromDiscord<amjadhd> (edit) "[code](https://play.nim-lang.org/#pasty=AccfaHCI)?" => "[code](https://play.nim-lang.org/#pasty=JXFNlrSz)?"
17:36:49FromDiscord<Elegantbeef> @amjadhd Iterables are not invokable
17:44:27FromDiscord<amjadhd> In reply to @Elegantbeef "<@629598664452734989> Iterables are not": I forgot to collect it🤦‍♂️
17:50:09FromDiscord<spotlightkid> Has anybody used https://git.sr.ht/~ehmry/nim_cbor successfully?↵Doesn't even install for me, since the .nimble file references a JSON file, which isn't copied to the installation dir.↵Any other CBOR decoders for Nim, which can decode arbitrary cbor-encoded blobs?
18:05:05FromDiscord<olfactoryhallucinations> https://git.sr.ht/~icedquinn/icedcbor is another one. Haven't tried it though.
18:11:11ehmryspotlightkid: you could rewrite the nimble file
18:19:18ehmryI thought nim_cbor was capatible with nimble but I cant really test it
18:20:29strogon14ehmry: sure, that's what I'd try next.
18:20:29strogon14but there are a few other problems, like e.g. occcurences of "import pkg/...", which doesn't work with Nim 2.x., and test depencencies not declared ("balls").
18:23:22ehmrycould pin to 86999bfc5dc0a419f82a8c39afa09180e917e3fc
18:24:41FromDiscord<spotlightkid> @olfactoryhallucinations\: yeah, found that one trhough the forum too, but no .nimble file, no docs, no tests, no examples \:-(
18:34:01strogon14ehmry: that still has most of the same issues (nimble file, import pkg/...)
18:34:46strogon14if I get it to work, I'll try reporting an issue.
18:38:42*nils` quit (Ping timeout: 252 seconds)
19:03:09ehmryyou'll have to just go back in time because I don't care about nimble or old nim
19:05:56ehmrythe code shouldn't have changed
19:19:16*nils` joined #nim
19:31:57FromDiscord<spotlightkid> or I'll just use msgpack 🤷
19:32:08FromDiscord<Elegantbeef> yes being able to configure their width↵(@lainlaylie)
19:32:20FromDiscord<Elegantbeef> But people always bring up alignment and I always say those people are daft
19:32:40FromDiscord<Elegantbeef> Cmon spotlight use vsbf and use the cutting edge of obscure binary formats
19:36:34FromDiscord<spotlightkid> This is all just for some experiments anyway. I'm trying to write a JACK audio backing track player controllable by some RPC mechanism. websockets+cbor or msgpack would be good, because it's easy to write web interface then and messages are small and UDP could be used as an alternative transport, but if it's too bothersome, I'll just use JSON.
19:37:19FromDiscord<Elegantbeef> Yea if it has to be standardized the vsbf option is out the window since there is precisely a single implementation 😄
19:41:29FromDiscord<Elegantbeef> Not that you'd ask, but it's only written for the native backend cause I do not care much for JS, though I probably should support JS and the VM
19:44:55FromDiscord<spotlightkid> I should probably try to avoid NIH and just use json-rpc. Pianoteq (piano modelling software) uses that too and writing a test client in Nim or Python was a matter of minutes. Whereas finding a Nim cbor lib that works out of the box... And I'm normally good at fixing upstream "wrinkles".
19:45:29FromDiscord<Elegantbeef> Just port vsbf to js for me and then use that 😜
19:47:32FromDiscord<spotlightkid> JS environment is not my favourite habitat.
20:04:49FromDiscord<TFed> do we have something to make urls out of REST?
20:04:50FromDiscord<TFed> if i said that correctly😁
20:04:50FromDiscord<TFed> i'm talking about API requests like Forgejo's API Github's API...
20:06:53FromDiscord<TFed> i'm just implementing this, but would be great if it exists
20:06:53FromDiscord<Elegantbeef> I don't know if there is any automagic tooling, but a good reference is https://github.com/beef331/dodger/tree/master/dodger/protocol imo
20:07:27FromDiscord<TFed> thank you 😊
20:17:36*ntat quit (Quit: Leaving)
20:17:47FromDiscord<TFed> this is for matrix, there also i found for discord https://github.com/krisppurg/dimscord/blob/master/dimscord/restapi
20:17:56FromDiscord<TFed> cool that it's all in nim
20:18:11FromDiscord<Elegantbeef> Well yea I know it's for matrix I wrote it 😛
20:20:48FromDiscord<Laylie> fixing the nimble file (i.e. making it a normal nimble file instead of trying to convert from some other thing) is enough to make that cbor library usable
20:21:36FromDiscord<TFed> https://github.com/watzon/github-api-nim
20:21:41FromDiscord<TFed> for github PI
20:21:44FromDiscord<TFed> for github API
20:21:59FromDiscord<TFed> wow super
20:23:08FromDiscord<TFed> and openapi code genrator https://github.com/disruptek/openapi
20:23:16FromDiscord<TFed> i found what i needed
20:23:18FromDiscord<TFed> thanks
20:23:30FromDiscord<TFed> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1402386463626367026): and openapi code generator https://github.com/disruptek/openapi
20:24:28FromDiscord<nasuray> In reply to @TFed "for github API": Seems like they haven't implemented much of the API yet though. Might be better off just using the rest API
20:25:44FromDiscord<TFed> ok, i think openapi is enough
20:33:42ehmryI just pushed a standard nimble file to that cbor library
20:34:39ehmrybut for a websocket I'd just use json, I've only been using CBOR for archiving
20:37:17*hygo joined #nim
20:40:32*amadaluzia quit (Quit: ZNC 1.10.1 - https://znc.in)
20:43:11*amadaluzia joined #nim
20:48:30*zgasma joined #nim
21:33:22*skippy8 joined #nim
21:56:58FromDiscord<summarity> Hey, though I'd share some stats about Nim on GitHub (since I both like Nim and work there): https://code.tc/nim-stats-august-2025/
21:57:30*amadaluzia quit (Ping timeout: 276 seconds)
22:09:43*amadaluzia joined #nim
22:28:20*rockcavera joined #nim
23:13:13*skippy8 quit (Quit: WeeChat 4.6.3)
23:25:24*jn_ quit ()
23:31:56*hygo quit (Ping timeout: 252 seconds)
23:48:50*tiorock joined #nim
23:48:50*tiorock quit (Changing host)
23:48:50*tiorock joined #nim
23:48:50*rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services)))
23:48:50*tiorock is now known as rockcavera
23:50:54*tiorock joined #nim
23:50:54*tiorock quit (Changing host)
23:50:54*tiorock joined #nim
23:50:54*rockcavera is now known as Guest8505
23:50:54*tiorock is now known as rockcavera
23:52:33*jn joined #nim
23:52:33*jn quit (Changing host)
23:52:33*jn joined #nim
23:53:56*Guest8505 quit (Ping timeout: 252 seconds)