<< 16-02-2025 >>

00:15:49FromDiscord<pedromsluz> In reply to @sys64 "My synth is modular": Hey, that looks good. Ur using Nim with an gui lib? which one?
00:32:18FromDiscord<summarity> Is there a good tool to generate static control flow diagrams for Nim (the eqivalent of `pyan3 file.py --uses --no-defines --colored --grouped --annotated --dot` in Python)?
00:33:13FromDiscord<Elegantbeef> How do we know what that does?
00:35:38FromDiscord<summarity> Exactly what I said - generates the required diagram :). Really any CFG dumping tool would help.
00:36:07FromDiscord<Elegantbeef> I'm being a bit coy cause I just want to know what that generates 😄
00:36:25FromDiscord<Elegantbeef> sourcetrail probably is the closest you'll get to graphical flow control
00:41:04FromDiscord<summarity> Here's an example output for `Nim/tools/debug/nim-gdb.py` https://media.discordapp.net/attachments/371759389889003532/1340483047862308958/lldb.png?ex=67b2859f&is=67b1341f&hm=1c8d803a1f192ded81f71579684d7b5c7ef40ee9b72b16649f11993f9ba8da7e&
00:41:28FromDiscord<Elegantbeef> Ah that'd actually be pretty easy to do in a macro
01:05:16FromDiscord<System64 ~ Flandre Scarlet> In reply to @pedromsluz "Hey, that looks good.": Dear ImGUI
01:22:33FromDiscord<Elegantbeef> @summarity I got nerdsniped to build the start of this you can finish it 😜 https://play.nim-lang.org/#pasty=SdcRnCWD
01:31:29FromDiscord<summarity> Excellent, thanks 😄
01:40:41FromDiscord<zumi.dxy> Am I not mistaken into thinking I can't put genSym() stuff inside of a `quote do`
01:40:47FromDiscord<zumi.dxy> (edit) "genSym()" => "`genSym()`"
01:41:55FromDiscord<zumi.dxy> that's the X;↵the Y is "I want 'private-to-macro' variables inside of a `quote do`
01:42:00FromDiscord<zumi.dxy> (edit) "do`" => "do`""
01:42:49FromDiscord<Elegantbeef> use genast
01:45:03FromDiscord<zumi.dxy> I'll check it out
01:45:44FromDiscord<Elegantbeef> You can do like `genast(myVar = genSym(nskVar, "test")): ...`
01:45:52FromDiscord<Elegantbeef> Or just use `var a{.gensym.}: T`
02:48:38*alexdaguy joined #nim
02:59:14*beholders_eye quit (Ping timeout: 260 seconds)
06:25:04*tiorock joined #nim
06:25:04*tiorock quit (Changing host)
06:25:04*tiorock joined #nim
06:25:04*rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services)))
06:25:04*tiorock is now known as rockcavera
06:41:18*PMunch_ joined #nim
06:44:01*PMunch__ quit (Ping timeout: 248 seconds)
08:15:01*ntat joined #nim
08:17:08*PMunch__ joined #nim
08:19:30*PMunch_ quit (Ping timeout: 246 seconds)
08:29:07*cnx quit (Remote host closed the connection)
08:29:57*cnx joined #nim
08:36:22*alexdaguy quit (Quit: restar)
08:52:01*mahlon quit (Ping timeout: 248 seconds)
08:52:29*mahlon joined #nim
08:59:51*coldfeet joined #nim
09:12:14FromDiscord<blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=MPjOiOsl
09:13:39FromDiscord<blashyrk> Actually just removing requiresinit removes the warning, but outside of my own "library" functions I'd like to enforce the end user initializing the type
09:14:09FromDiscord<jabuci> sent a code paste, see https://play.nim-lang.org/#pasty=XCTfrMsT
09:14:37FromDiscord<blashyrk> (edit) "type" => "type↵↵I suppose I could just have a temp .noinit. array and move it into result somehow at the end? But coming from rust i don't know if nim has move semantics"
09:38:50FromDiscord<jabuci> If I add this forward declaration: `proc printf(format: cstring): cint {.importc, header: "<stdio.h>", varargs.}`, then it works. But c2nim didn't add this line automatically.
09:39:28FromDiscord<jabuci> sent a code paste, see https://play.nim-lang.org/#pasty=mfmzDDsG
09:54:27FromDiscord<solitudesf> c2nim can't do that. it just converts syntax. you need to post-process c2nim's output.
09:54:42FromDiscord<solitudesf> use futhark for more automated approach
10:21:40FromDiscord<rakgew> futhark does a different thing though\: it does not convert c to nim code but instead wraps the c code in an automated way.↵● so if the intention is\: "use that c lib over there", then futhark sounds like a good choice.↵● but if the intention is\: "create nim code from this c code", that is not something that futhark helps with afaik.
10:24:03FromDiscord<rakgew> so it may depend on the use-case.
10:27:00FromDiscord<gogolxdong666> There is a niche for Nim which lies in MCP server
10:29:21FromDiscord<zumi.dxy> you know, I thought I was gonna just use javascript and leave the server side stuff to Nim↵but if I want to generate stuff on the client-side and I already have a templating library I'd be nuts not to use it there too
10:29:57FromDiscord<zumi.dxy> I tried writing PHP with almost vanilla JS↵was maddening trying to sync two different versions of an HTML component
10:32:55FromDiscord<zumi.dxy> I could look into rendering fragments server-side directly as HTML rather than using JSON as usual and then I could still write my vanilla JS, but something to be said about multi-language codebases…
10:39:06FromDiscord<jabuci> Nim has a secret REPL that can be accessed with `nim secret`. There are 3rd-party REPLs too, like `inim`. What's the difference?
10:40:20FromDiscord<jabuci> sent a code paste, see https://play.nim-lang.org/#pasty=iLZpWEay
10:41:22FromDiscord<gogolxdong666> I'm using Roo Cline+Claude3.5 sonnet+Claude App client to learn from and extend nimony.
10:42:27FromDiscord<gogolxdong666> most MCP servers use npx and python
10:44:01FromDiscord<solitudesf> In reply to @jabuci "And in the REPL": `^` is defined in `math` and requires ffi, which doesn't work in nimvm.
10:44:44FromDiscord<jabuci> Oh, OK. After `import math` it works. Thanks.
10:44:54FromDiscord<solitudesf> In reply to @jabuci "Nim has a secret": `nim secret` uses nimvm, which has limitions, `inim` pretends to be repl by recompiling the file and diffing the output.
10:45:01FromDiscord<solitudesf> (edit) "limitions," => "limitations,"
10:45:54FromDiscord<jabuci> Err, what is the nimvm? For me, nim is a compiler.
10:50:04FromDiscord<solitudesf> In reply to @jabuci "Err, what is the": nimvm is nim interpreter, which is used for compile-time evaluation, macros and nimscript.
11:00:36FromDiscord<bendugo> any idea on why this was archived: https://github.com/FedericoCeratto/nim-package-directory
11:07:47FromDiscord<zumi.dxy> There's this mirror on codeberg: https://codeberg.org/FedericoCeratto/nim-package-directory↵It's apparently his only Nim project there, the others weren't mirrored yet
11:37:43FromDiscord<Phil> So apparently `re` is deprecated now?↵I'm getting compiler warnings to move to `re2`, the big question being where the re2 is defined in order to import it
11:40:12FromDiscord<jabuci> Nim has a C and a C++ backend. Are they equivalent or is the C backend better? Why do they support both?
11:46:38FromDiscord<lainlaylie> for interfacing with c++ libraries. otherwise, use the c backend
11:47:32FromDiscord<lainlaylie> In reply to @isofruit "So apparently `re` is": in the same module as re, just replace your calls to re with re2
11:47:53FromDiscord<Phil> In reply to @isofruit "So apparently `re` is": Turns out, prologue exports re from the regex lib, so basically this requires a prologue update
11:48:17*rockcavera quit (Read error: Connection reset by peer)
11:48:37*rockcavera joined #nim
11:48:44FromDiscord<zumi.dxy> In reply to @isofruit "So apparently `re` is": is that the pure nim library
11:49:32FromDiscord<Phil> I think it is (?)↵Seem to me like it's this one: https://github.com/nitely/nim-regex
11:51:59FromDiscord<Phil> Aaaaand it seems it's not as easy as just migrating to "re2"
11:53:22FromDiscord<lainlaylie> what's the issue
11:55:21FromDiscord<Phil> Ah, there we go, prologue needs to update its whole machinery to support the re2 types
11:55:23FromDiscord<Phil> That was the problem
11:56:10FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=JBasvPoW
11:56:32FromDiscord<Phil> addRoute being a prologue proc
11:56:32FromDiscord<lainlaylie> indeed, re2 returns a different type
11:56:39FromDiscord<lainlaylie> other than that the interface seems to be identifal
11:56:46FromDiscord<lainlaylie> i do wonder why they didnt just replace the implementation transparently
11:57:13FromDiscord<Phil> I'll see what happens if I export all the necessary types and add an addRoute overload
11:57:20FromDiscord<Phil> Not holding up hope that that'll do it though
12:01:50FromDiscord<lainlaylie> https://github.com/nitely/nim-regex/blob/master/CHANGELOG.md#v0210
12:02:10FromDiscord<lainlaylie> sent a code paste, see https://play.nim-lang.org/#pasty=czBrUSRR
12:06:11FromDiscord<blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=hHtBRUhW
12:08:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=DEyvGIhu
12:08:50FromDiscord<Phil> That... sounds annoying enough for me to not want to bother.
12:12:04FromDiscord<lainlaylie> In reply to @blashyrk "Is it possible to": how about something like zip from https://github.com/planetis-m/looper
12:14:57FromDiscord<lainlaylie> https://github.com/beef331/slicerator also has zipIter
12:17:07FromDiscord<blashyrk> Thanks, I'll give them a shot!
12:18:20FromDiscord<blashyrk> https://tenor.com/view/crab-rave-dancing-dancing-crab-gif-16543314
12:18:22FromDiscord<blashyrk> zip from slicerator works!
12:18:33FromDiscord<blashyrk> Ugh I thought it would be an inline gif xd
12:19:43FromDiscord<blashyrk> (edit) "zip" => "zipIter"
12:21:50FromDiscord<Phil> We don't have a way to rename a symbol on improt/export, do we
12:22:01FromDiscord<Phil> (edit) "improt/export," => "import/export,"
12:22:14FromDiscord<Phil> I see renaming modules, but not symbols, in the manual
12:22:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=NjroUmky
12:55:13FromDiscord<lainlaylie> how about making type aliases and exporting those?
12:57:20FromDiscord<lainlaylie> though if it were my library I'd just let my users break, it's an easy migration anyway
13:22:12FromDiscord<Phil> Type alias becomes difficult when you have scenarios such as `var someVar: RegexMatch`
13:22:50FromDiscord<Phil> This is the kind of stuff that makes updating an application over time intensely annoying
13:23:47FromDiscord<Phil> Did teach me that stability of your base libs, particularly in BE, is something to pay attention to
15:54:05*coldfeet quit (Quit: Lost terminal)
15:58:32*coldfeet joined #nim
16:35:27FromDiscord<fl4shk> What is "BE" short for?
16:35:37FromDiscord<fl4shk> I'm assuming it's not "Big Endian"
16:57:17*tiorock joined #nim
16:57:17*rockcavera is now known as Guest7237
16:57:17*Guest7237 quit (Killed (tantalum.libera.chat (Nickname regained by services)))
16:57:17*tiorock is now known as rockcavera
16:59:22*tiorock joined #nim
16:59:22*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
16:59:22*tiorock is now known as rockcavera
17:08:57FromDiscord<lainlaylie> backend?
17:21:25*beholders_eye joined #nim
17:46:45FromDiscord<fl4shk> ah gotcha
17:46:48FromDiscord<fl4shk> that makes more sense
17:55:10*beholders_eye quit (Quit: WeeChat 4.1.2)
18:02:23FromDiscord<Elegantbeef> @Phil no there are no import symbol renames, but I don't see how an alias doesn't work
18:05:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=IBISTdye
18:05:09FromDiscord<Elegantbeef> This works just fine
18:07:49*Lord_Nightmare quit (Ping timeout: 248 seconds)
18:36:07*coldfeet quit (Quit: Lost terminal)
18:47:08FromDiscord<blashyrk> Would it be possible, using macros, to define distinct types that actually share procs/initializers/fields defined on the original type, but only serve to prevent mixing types in these operations? The current implementation of distinct types seems really barebones and not that useful (the distinct types have absolutely nothing in common with the original type, so... what's the point?)
18:47:46FromDiscord<heysokam> In reply to @blashyrk "Would it be possible,": are you aware of `{.borrow.}`?
18:48:01FromDiscord<Elegantbeef> That's the entire point
18:48:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=jSmfjuWl
18:48:20FromDiscord<heysokam> ^
18:48:45FromDiscord<blashyrk> I am but:↵1) Distinct type created from object types are not themselves object types (wut?) ↵2) Borrowing from object types just borrows fields but nothing else apparently. How do I even construct a distinct type created from an object type if it itself is not an object type?
18:48:51FromDiscord<Elegantbeef> You also can define a converter from your distinct to base so you never decay to the original type suddenly
18:49:03FromDiscord<Elegantbeef> I mean decay to the distinct
18:49:03FromDiscord<Elegantbeef> The current usage of distinct is perfect
18:49:50FromDiscord<heysokam> #2 is what borrow is for
18:50:05FromDiscord<Elegantbeef> Like I wrapped Opengl GlUints with distinct and I can never accidentally do math operations on them
18:50:07FromDiscord<Elegantbeef> Why would I want to inherit that 😄
18:50:22FromDiscord<Elegantbeef> I will say I do want a distinct that is weaker where it decays to the parent implicitly without a converter written by the user
18:52:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zXJBAfJE
18:52:13FromDiscord<blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=eDQeRaib
18:52:35FromDiscord<blashyrk> My point is, what's the use for distinct types when they don't inherit anything except maybe fields, when I can just define a completely different type instead?
18:53:20FromDiscord<Elegantbeef> Cause they have relations to their parent
18:53:31FromDiscord<Elegantbeef> You cannot do `int(myType)` if you have a `type NotInt = object i: int`
18:54:12FromDiscord<blashyrk> So I can temporarily "convert" them to the parent type, do some operations and "downcast" them back to the distinct type perhaps?
18:54:51FromDiscord<heysokam> In reply to @blashyrk "So I can temporarily": or have the base common function take the base common type instead
18:54:53FromDiscord<Elegantbeef> A converted distinct is a 'R-value' so yes
18:57:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gPtNaVEv
18:58:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=jJdHHUIS
18:58:13FromDiscord<heysokam> I recommend vmath's approach for solving this. Distinct feels unnecessary for solving generics↵https://github.com/treeform/vmath/blob/master/src/vmath.nim
18:59:09FromDiscord<Elegantbeef> I concur, I'm just going with a "If we must use this tool"
18:59:36FromDiscord<Elegantbeef> I use distinct for two things mainly, a variant of a type that is meant to behave differently then the base or a way to dispatch without having to pass a flag of `isBleh` around
18:59:48*ntat_ joined #nim
19:00:19*ntat_ quit (Client Quit)
19:02:25*ntat quit (Quit: Leaving)
19:02:52FromDiscord<Elegantbeef> Then inside my shader loading code instead of passing `isPath` I just have `ShaderFile` and `ShaderPath` I convert a string into
19:02:52FromDiscord<Elegantbeef> so I can do `loadShader(ShaderFile(staticRead"someShader.vert"), ShaderFile(staticRead"someShader.frag"))`
19:03:00*ntat joined #nim
19:05:08FromDiscord<blashyrk> I'd assumed that they worked like this:↵1) You basically get the same type as the base type incl all operations/functions/initializers etc↵2) You cannot mix and match using the distinct type with the base type in this operations. So in my instance you cannot add a Vector to a Color
19:05:29FromDiscord<blashyrk> Thanks, both 🙂 I'll check out vmath
19:09:46FromDiscord<Elegantbeef> Nah you cannot actually have them take all the operations/functions
19:09:58FromDiscord<Elegantbeef> It defeats the point of distinctness
19:10:43FromDiscord<Elegantbeef> When you apply an operation to a distinct value there is no knowing that the resultant value is a valid distinct value
19:11:56FromDiscord<blashyrk> Yeah that makes sense
19:12:25FromDiscord<Elegantbeef> Using implicit conversions to the base type then converting back is the 'best' approach
19:13:06FromDiscord<Elegantbeef> This stops things like `type ValidEmail = distinct string` from doing things like `var someEmail: Email = a & b`
19:13:14FromDiscord<Elegantbeef> Whoops `: ValidiEmail` 😄
19:21:09*tiorock joined #nim
19:21:09*rockcavera is now known as Guest1106
19:21:09*Guest1106 quit (Killed (tantalum.libera.chat (Nickname regained by services)))
19:21:09*tiorock is now known as rockcavera
19:23:09FromDiscord<blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=EIwLLKpa
19:23:14*tiorock joined #nim
19:23:14*rockcavera is now known as Guest2280
19:23:14*tiorock is now known as rockcavera
19:23:54FromDiscord<blashyrk> I guess the worst part of it would be adding another tuple kind, especially externally if this should be considered "library code", but other than that it seems to hit the spot 😄
19:25:07FromDiscord<Elegantbeef> You reinvented distinct, so good job!
19:26:24*Guest2280 quit (Ping timeout: 252 seconds)
19:26:27FromDiscord<Elegantbeef> Pure is also a pointless pragma nowadays
19:26:55FromDiscord<blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=POsYKhuj
19:27:17FromDiscord<Elegantbeef> I'll show you
19:45:43FromDiscord<Elegantbeef> A bit nasty as it needs a single concept, but alas https://play.nim-lang.org/#pasty=KHPxLFhC
19:46:11FromDiscord<Elegantbeef> You now can define any operations just by converting to a same type
19:46:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BlJUZBoj
19:46:56FromDiscord<Elegantbeef> drop the `=`
19:47:36FromDiscord<Elegantbeef> I still would prefer the vmath method, but you do you
19:56:14FromDiscord<blashyrk> Thanks! And doubly so for taking the time 🍻
21:31:14*ntat quit (Quit: leaving)
22:27:34FromDiscord<aintea> In reply to @Elegantbeef "Pure is also a": Why does it still exist then ?
22:28:09FromDiscord<aintea> I really hope Nim will not live with the C++ nightmare where there are 39107429 ways to do one things and half of them are deprecated or pointless
22:28:56FromDiscord<aintea> I'm not saying I want something like Gleam where there is (almost) always only one way to do something, but I'm not sure having a language that have 183928 things and half of them are for retro compatibility is a good idea
22:33:27FromDiscord<zumi.dxy> that would be possible if a language compiler straight up says "pick a version and stick with it forever"
22:33:40FromDiscord<zumi.dxy> but we know this is to be avoided
22:34:03FromDiscord<zumi.dxy> so we're... kinda stuck with both outdated and new solutions coexisting
23:01:07FromDiscord<nieznanymagnat> sent a long message, see https://pasty.ee/qKKgmsIh
23:10:24FromDiscord<fl4shk> because it's equivalent
23:10:38FromDiscord<fl4shk> some kinds of CPUs do the same thing :)
23:10:40FromDiscord<fl4shk> like RISC-V
23:43:36*alexdaguy joined #nim