<< 12-06-2025 >>

00:15:09*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
00:41:12*redj joined #nim
00:53:04*tiorock joined #nim
00:53:04*tiorock quit (Changing host)
00:53:04*tiorock joined #nim
00:53:04*rockcavera is now known as Guest9206
00:53:04*tiorock is now known as rockcavera
00:55:59*Guest9206 quit (Ping timeout: 260 seconds)
01:51:35*amadaluzia quit (Quit: ZNC 1.9.1 - https://znc.in)
03:02:17*rockcavera quit (Remote host closed the connection)
03:03:46FromDiscord<nasuray> In reply to @pmunch "And a lot less": Thanks for keeping the forums usable and free of spam!
04:34:44*nils` quit (Ping timeout: 260 seconds)
04:44:49FromDiscord<myriad_colors> If Nim hadn't inherited the enforced indentation rules from Python, it would be the perfect replacement for it.
04:44:58FromDiscord<myriad_colors> at least for me
04:46:05FromDiscord<myriad_colors> I swear, Im loving it.
04:56:29FromDiscord<pmunch> You get used to the indentation after a while
05:00:34FromDiscord<myriad_colors> Is there some formatter that fixes the indentation for me?
05:17:02FromDiscord<Phil> nph should work for this
05:37:23FromDiscord<pmunch> In reply to @myriad_colors "Is there some formatter": Define fixes, since indentation decides what belongs to which block it isn't always clear what the "correct" formatting is without the programmers intent
05:48:48FromDiscord<myriad_colors> Well, assuming each indent is a tab of 4 spaces, then i assume that 'fix' means correct any indent that is not at the correct width, usually its not hard to infer this by context, but its annoying to handle.
05:50:05Amun-Rathere's nimpretty, but I've never used it in a while; I'm not a sloppy programmer ;)
05:51:04FromDiscord<myriad_colors> Yeah, im abd at keeping the code tidy
05:55:38FromDiscord<Elegantbeef> Cannot format out a 5 character indent cause it's invalid syntax and ambiguous
05:56:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ApYlKYRA
05:58:55FromDiscord<myriad_colors> sent a code paste, see https://play.nim-lang.org/#pasty=YZhQVSEl
05:59:36FromDiscord<Elegantbeef> Why is that more valid than into the if statement?
06:03:05*shrikant joined #nim
06:05:22Amun-Rathat's why 4 space idents make more sense; we could snap it to the side with less space char difference ;>
06:05:37Amun-Ra3*
06:15:10*ntat joined #nim
06:16:46*beholders_eye joined #nim
06:19:12FromDiscord<janakali> In reply to @Elegantbeef "Cannot format out a": solution: formatter defaults to inner indent and by typing ';' you tell it to exit the scope
06:20:41FromDiscord<Elegantbeef> Real solution\: learn to write clean code
06:22:47Amun-Ra+1
06:24:25FromDiscord<janakali> but muh tooling
06:25:49FromDiscord<myriad_colors> In reply to @Elegantbeef "Why is that more": So you are telling me that, because a few case are ambiguous, I shouldnt rely on formatters? This says mroe about enforcing indenting than it says about formatters.
06:26:12FromDiscord<Elegantbeef> Well you said you want to fix code
06:26:17FromDiscord<myriad_colors> Fix indenting
06:26:24FromDiscord<myriad_colors> its a different matter.
06:26:32FromDiscord<Elegantbeef> I provided a reason why you cannot fix indentation if it's not consistent
06:26:40FromDiscord<Elegantbeef> Formatters can format code just fine
06:27:14FromDiscord<myriad_colors> Again, this says more about indentation and whitespaces being meaningful
06:27:22FromDiscord<Elegantbeef> Not particularly
06:27:30FromDiscord<Elegantbeef> Cause you're going to write the same code anyway
06:28:07FromDiscord<Elegantbeef> I wrote C# before I wrote Nim and I never attempted to use a formatter to fix indentation
06:28:15FromDiscord<myriad_colors> Not if changing indentation changes the semantics.
06:28:42FromDiscord<Elegantbeef> Uh huh
06:28:53FromDiscord<lainlaylie> indentation is our curly braces, a formatter cannot guess what you meant
06:29:03FromDiscord<myriad_colors> Yep, I am free to dislike this particular convention.
06:29:21FromDiscord<myriad_colors> Anyway, that said, it is a great language.
06:29:36FromDiscord<myriad_colors> I can deal with this annoyance.
06:29:48FromDiscord<myriad_colors> In reply to @lainlaylie "indentation is our curly": Just use braces.
06:30:06FromDiscord<Elegantbeef> Nah braces are redundant since everyone already does properly indented code
06:30:15FromDiscord<lainlaylie> this is nim
06:43:54*Jjp137 quit (Quit: Leaving)
06:48:26FromDiscord<nnsee> this isn't a loaded question but why do you write code with messed up indentation in the first place
06:48:35FromDiscord<nnsee> or like how does that even happen
07:06:27*ntat quit (Read error: Connection reset by peer)
07:18:55*ntat joined #nim
07:21:23FromDiscord<Phil> sent a long message, see https://pasty.ee/LxpXiARw
07:21:36*ntat quit (Read error: Connection reset by peer)
07:21:42FromDiscord<Phil> Though I guess it's somewhat easier to fall into those trappings with meaningful indentation.
07:22:20FromDiscord<Phil> (edit) "https://pasty.ee/sHJKfILb" => "https://pasty.ee/QmoKfmQx"
07:23:39*Jjp137 joined #nim
07:24:02FromDiscord<Phil> But that was just to be on the complete side, I think for the unambiguous cases nph can help (there's an extension for it afaik)
07:39:24*jjido joined #nim
07:49:11FromDiscord<madonuko> using a formatter with owlkettle is a nightmare tho
07:49:29FromDiscord<madonuko> and I just gave up and not use LSPs and formatters
07:50:43FromDiscord<Phil> In reply to @madonuko "using a formatter with": That one I'm not surprised about, when you use macros that essentially define a new language, then I don't think nph can do much there
07:51:08FromDiscord<Phil> Though I might be wrong on that one
07:51:17FromDiscord<madonuko> eh, in rust the formatter ignores everything in a macro body
07:51:24FromDiscord<madonuko> I kinda expected the same thing in nim
07:52:08FromDiscord<Phil> Would need to ask arnetheduck if he knows more on the matter
07:55:05FromDiscord<pmunch> In reply to @isofruit "That one I'm not": Depends on the macro though, some macros would format just fine
07:58:03FromDiscord<pmunch> One pro of spaces vs. brackets for us non-american folk: no more AltGr!
07:58:09FromDiscord<pmunch> Or at least a lot less of it
07:58:40FromDiscord<pmunch> To do {} on my keyboard is AltGr+7 and AltGr+0 (8 and 9 are for [ and ] respectively)
07:58:48FromDiscord<pmunch> Much easier to hit space or tab 🙂
08:03:29FromDiscord<Phil> In reply to @pmunch "One pro of spaces": That means you get less value out of your keyboard!
08:04:07FromDiscord<Phil> AltGr already faces a lot less wear&tear!
08:07:24*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
08:50:41*nils` joined #nim
09:43:43FromDiscord<bubbly_avocado_86424> hey, since looking into building an app with UI (one or more of GUI/TUI/WUI) i'm looking at webUI but also considering use of Tauri since this covers a lot of ground already. ↵↵Is there a good resource on working Nim + Tauri outside of what is on the Tauri website ?
09:43:59FromDiscord<bubbly_avocado_86424> (edit) "hey, since looking into building an app with UI (one or more of GUI/TUI/WUI) i'm looking at webUI but also considering use of Tauri since this covers" => "sent" | "lot of ground already. ↵↵Is there a good resource on working Nim + Tauri outside of what is on the Tauri website ?" => "long message, see https://pasty.ee/aDcxHOJR"
10:19:44*beholders_eye quit (Quit: WeeChat 4.5.1)
10:20:06*beholders_eye joined #nim
10:31:10FromDiscord<janakali> In reply to @janakali "I made a thing:": GrabNim can now install nightlies and compile nim from source!
10:32:26FromDiscord<janakali> (edit) "nim" => "Nim"
10:37:35FromDiscord<lainlaylie> cool
11:05:25*beholders_eye quit (Ping timeout: 248 seconds)
11:32:03*xet7 joined #nim
11:56:37*xet7 quit (Ping timeout: 252 seconds)
11:57:42*xet7 joined #nim
12:41:12FromDiscord<madonuko> In reply to @janakali "GrabNim can now install": can this be run and installed as root? I'm interesting in packaging this in terra
12:49:00FromDiscord<Trayambak> I'm sorry if I'm being stupid but what advantages does GrabNim have over choosenim? \:P↵(@janakali)
12:54:38FromDiscord<madonuko> sent a long message, see https://pasty.ee/MsBSGbBk
13:19:34FromDiscord<janakali> In reply to @Trayambak "I'm sorry if I'm": 1. grabnim doesn't use shims↵2. grabnim doesn't create dirs in $HOME↵3. grabnim doesn't override your binaries in "~/.nimble/bin"↵4. latest choosenim release currently still has a bug that causes hundreds nimsuggest processes in lsp
13:26:47FromDiscord<janakali> In reply to @madonuko "can this be run": I've never considered it running as root. But installing it to "/usr/bin" and running with normal user privileges should be fine.
14:35:14FromDiscord<axgam> yo guys im new to nim and C performance for python-lua looks sounds awesome! does Nim support OpenGL bindings? I am very new sorry for dumb questions.
14:35:49FromDiscord<axgam> also what is grabnim and choosenim
14:43:38FromDiscord<madonuko> hey it seems to work as root
14:43:43FromDiscord<madonuko> packaged it
14:45:10FromDiscord<madonuko> <https://github.com/terrapkg/packages/pull/5342>
14:47:10FromDiscord<demotomohiro> In reply to @itsaxgam "yo guys im new": I used this library to use OpenGL before: https://github.com/johnnovak/nim-glfw
14:47:45FromDiscord<axgam> thanks! i will check it out!
15:00:51FromDiscord<gokr> @janakali Cool, will try grabnim (avoided choosenim after lsp issues)
15:01:08*beholders_eye joined #nim
15:05:33*jjido joined #nim
15:24:44*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
16:42:28*andy-turner joined #nim
16:42:52*andy-turner quit (Remote host closed the connection)
16:59:36FromDiscord<Robyn [She/Her]> In reply to @myriad_colors "If Nim hadn't inherited": enforced indentation rules? as in?
17:00:07FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "there's nimpretty, but I've": nimpretty is not great, tbh
17:03:23Amun-RaI write nim… pretty already… ;)
17:03:49FromDiscord<Robyn [She/Her]> In reply to @demotomohiro "I used this library": treeform also has a lib for this, right? windy or smth?
17:04:00FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "I write nim… pretty": same tho
17:04:55FromDiscord<Robyn [She/Her]> i am interested in making a customisable formatter for Nim tho, either as a nph fork/ext, or just a new thing... tho using existing work is defo better than writing something new
17:14:02FromDiscord<demotomohiro> In reply to @battery.acid.bubblegum "treeform also has a": https://github.com/treeform/windy↵This one?↵It says: "This library is still in development and is not ready to be used."
17:18:32FromDiscord<Phil> TFW you're arne, you make a pretty well publicized formatter plugin and nobody talks about it when the topic of formatting comes up
17:18:54*beholders_eye quit (Ping timeout: 260 seconds)
17:18:58FromDiscord<Phil> At this point I'd not ever even mention nimpretty and just always mention nph when it comes to formatting
17:48:11*xet7 quit (Remote host closed the connection)
17:49:39*xet7 joined #nim
18:13:58*ntat joined #nim
18:16:56FromDiscord<heysokam> In reply to @itsaxgam "yo guys im new": yes. I have an app that does use opengl. this is what I used:↵https://github.com/heysokam/tinyfb/blob/395e787c9a5af9f2f730f19c72bcc01ee26adba4/tinyfb.nimble#L20-L21
18:23:56FromDiscord<heysokam> In reply to @battery.acid.bubblegum "i am interested in": when nph was announced, I brought up the lack of customization and the reply was that nph was made with customization in mind, and it just was not exposed. I was also recommended to fork for that reason
18:41:33*jjido joined #nim
19:10:13*xet7 quit (Remote host closed the connection)
19:11:45*xet7 joined #nim
19:12:10FromDiscord<Robyn [She/Her]> Is it safe to cast `proc(a: Ctx)` to `proc(a: CtxBase)` where CtxBase is `ref object of RootObj` and Ctx is `ref object of CtxBase`
19:12:17FromDiscord<Robyn [She/Her]> makes sense honestly↵(@heysokam)
19:20:16FromDiscord<heysokam> In reply to @Robyn "Is it safe to": Last time I tried it I didn't get good outcomes. Maybe someone knows some trick to make it safe, but it didn't work for me even for types that had the same structure internally
19:20:24*xet7_ joined #nim
19:20:58FromDiscord<heysokam> can't remember if they were `ref object` or not, though
19:21:27Amun-Racast object itself
19:23:13*xet7 quit (Ping timeout: 276 seconds)
19:24:53FromDiscord<Robyn [She/Her]> Since they're references, I think there should be no problem, but I can't be sure without testing ig
19:26:28*xet7_ quit (Ping timeout: 276 seconds)
19:26:55*andy-turner joined #nim
19:27:27*andy-turner quit (Read error: Connection reset by peer)
19:33:19*xet7 joined #nim
19:34:05FromDiscord<nocturn9x> does anyone know of a reliable way to serialize a large nim object to disk? I have a ~36MB neural network that I currently embed into my executable using `staticRead`. For efficienty purposes I'd like to be able to `cast` this string/byte stream to the object itself instead of copying from the constant into a new object. I've tried in the past but apparently the VM's compile time ability to cast is very limited. Any workarounds?
19:37:01FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=qIBOGgdi
19:37:41FromDiscord<nocturn9x> this is the object (`FT_SIZE=704`, `HL_SIZE=1536`, `NUM_INPUT_BUCKETS=16`, `NUM_OUTPUT_BUCKETS=8`, `ALIGNMENT_BOUNDARY=64`)
19:38:54FromDiscord<nocturn9x> I am willing to work around nim's limitations by doing `cimport` hackery, if necessary
19:39:08FromDiscord<nocturn9x> I just don't know the black magic required to do this
19:39:22FromDiscord<nocturn9x> C/C++ chess engine devs do it just fine so it must be possible
19:40:17FromDiscord<Elegantbeef> Is there any reason you don't just static read then `let myVar = cast[ptr T](myVarData[0].addr)`?
19:41:22FromDiscord<nocturn9x> iirc I tried this in the past and it failed, the reason being that the raw binary file I read in is not padded the same way as the object
19:41:34FromDiscord<nocturn9x> as you can see, each layer is padded to 64 bytes
19:41:42FromDiscord<Robyn [She/Her]> https://play.nim-lang.org/#pasty=ZgAQQuPv this doesn't work 😔
19:41:44FromDiscord<nocturn9x> whereas the network file is padded to 64 bytes as a whole
19:41:50FromDiscord<Elegantbeef> How can you cast it to an object if it's not padded the same way?
19:42:12FromDiscord<nocturn9x> well what I was hoping to be able to do is have a utility that loads the network into memory and dumps the raw bytes of the entire object to disk
19:42:22FromDiscord<nocturn9x> then I load _that_ into my `staticRead`
19:42:33FromDiscord<nocturn9x> and `cast` with that
19:42:48FromDiscord<Elegantbeef> Robyn `{.nimcall.}`
19:42:51FromDiscord<nocturn9x> though it wouldn't be pointers
19:43:07FromDiscord<Elegantbeef> Right if the dumped data is the same as the object the padding will be fine on a read from the dump
19:43:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=AZCnOjHr
19:43:49FromDiscord<Elegantbeef> That will work the same as `let myVar = cast[T](staticRead"bleh")`
19:44:07FromDiscord<nocturn9x> the answer then is how do I dump the object
19:44:17FromDiscord<nocturn9x> I tried doing it on my own and it didn't work :(
19:45:30FromDiscord<nocturn9x> In reply to @Elegantbeef "That will work the": ah see there lies the problem
19:45:33FromDiscord<nocturn9x> it can't be `let`
19:45:37FromDiscord<nocturn9x> it has to be `const`
19:45:47FromDiscord<nocturn9x> otherwise it won't be a constant and I will get none of the benefits
19:45:58FromDiscord<nocturn9x> hence why I mentioned `cimport` shenanigans
19:46:24FromDiscord<Elegantbeef> the stdlib `write` procedure
19:46:25FromDiscord<Robyn [She/Her]> Ah lemme try
19:46:25FromDiscord<Elegantbeef> `file.write(myData.addr, sizeof(myData))`
19:46:25FromDiscord<Robyn [She/Her]> Yay it works, thanks Beef
19:46:27FromDiscord<Elegantbeef> Sorry `writeBuffer`
19:46:37FromDiscord<nocturn9x> gotcha
19:46:54FromDiscord<nocturn9x> it will still be `let` though
19:47:03FromDiscord<nocturn9x> meaning it will be a variable somewhere
19:47:14FromDiscord<nocturn9x> I need it to be a constant, like just a verbatim thing in `.bss` or whatever
19:47:22FromDiscord<nocturn9x> that's what gets me the efficiency gains
19:47:40FromDiscord<nocturn9x> otherwise there's no point to any of this
19:47:52FromDiscord<Elegantbeef> the string data will be in the rodata section
19:49:16FromDiscord<nocturn9x> that's not what I need
19:49:25FromDiscord<nocturn9x> I need `myVar` to be there
19:49:29FromDiscord<nocturn9x> otherwise it's pointless
19:49:35FromDiscord<Elegantbeef> Well then time to replicate it using emit
19:49:47FromDiscord<nocturn9x> let me show you how C++ engines do it
19:49:57FromDiscord<Elegantbeef> I don't care how they do it, I cannot read C++
19:50:39FromDiscord<nocturn9x> fair lol
19:50:45FromDiscord<Elegantbeef> Use emit to replicate it
19:50:48FromDiscord<nocturn9x> still, they use `reinterpret_cast`
19:50:51FromDiscord<Elegantbeef> Or use codegendecl
19:50:58FromDiscord<nocturn9x> on an already constant byte stream
19:51:23FromDiscord<nocturn9x> In reply to @Elegantbeef "Use emit to replicate": idk how to use that tbh
19:51:29FromDiscord<nocturn9x> emit has always been quite weird for me
19:51:41FromDiscord<Elegantbeef> Emit is just writing C inline
19:51:45FromDiscord<Elegantbeef> It's nothing fancy
19:52:13FromDiscord<nocturn9x> hmm
19:53:40FromDiscord<nocturn9x> I'll have to fiddle with it ig
19:54:29*xet7 quit (Ping timeout: 248 seconds)
19:54:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JGHykfAH
19:55:01FromDiscord<Elegantbeef> Or w/e they do in C
20:06:52*xet7 joined #nim
20:11:20Amun-Ra.bss → .data
20:20:29*xet7 quit (Quit: Leaving)
20:20:50*xet7 joined #nim
20:25:20*ntat quit (Ping timeout: 272 seconds)
20:37:00FromDiscord<Robyn [She/Her]> Matt, what's the problem if it's a variable, exactly? since it'd be in memory, isn't that better than it solely being on disk?
20:40:58Amun-Rahe wants the data as const memory, without copying all the data at the start
20:52:58FromDiscord<leorize> why do you think so?↵(@nocturn9x)
20:53:13FromDiscord<leorize> string literals are CoW from static storage by default
20:55:27FromDiscord<leorize> if you need it as `T`, just cast the string data pointer to `ptr T` and you will have static storage `T`
21:04:11FromDiscord<nocturn9x> I don't need a ptr tho?
21:04:18FromDiscord<nocturn9x> In reply to @Amun-Ra "he wants the data": ^^
21:04:43FromDiscord<nocturn9x> In reply to @battery.acid.bubblegum "Matt, what's the problem": if it's a constant in the executable then it doesn't get deduplicated, no matter how many instances of the engine are running
21:04:47FromDiscord<Elegantbeef> Hey my echo is a bit delayed
21:04:57FromDiscord<nocturn9x> when running the engine in separate processes, this boosts performance
21:05:01FromDiscord<leorize> the ptr is just an implementation detail
21:05:05FromDiscord<nocturn9x> (this is the case in testing)
21:05:30FromDiscord<nocturn9x> I'll try though
21:36:37*amadaluzia joined #nim
21:43:34*rockcavera joined #nim
21:48:35FromDiscord<Robyn [She/Her]> In reply to @nocturn9x "when running the engine": fair i think?
21:55:18*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
22:10:31*mahlon quit (Quit: PotatoTech)
22:13:59FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=wKSiyHLQ
22:14:47FromDiscord<heysokam> Either way you are achieving the same thing, so it depends on how you prefer to solve it
22:18:44*beholders_eye joined #nim
22:26:18FromDiscord<nocturn9x> thanks!
22:26:25FromDiscord<nocturn9x> looks simple enough ig!
22:26:29FromDiscord<nocturn9x> will give it a shot
22:31:43*beholders_eye quit (Ping timeout: 276 seconds)
22:43:07*amadaluzia quit (Quit: ZNC 1.9.1 - https://znc.in)
23:02:25*mahlon joined #nim