00:15:49 | FromDiscord | <pedromsluz> In reply to @sys64 "My synth is modular": Hey, that looks good. Ur using Nim with an gui lib? which one? |
00:32:18 | FromDiscord | <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:13 | FromDiscord | <Elegantbeef> How do we know what that does? |
00:35:38 | FromDiscord | <summarity> Exactly what I said - generates the required diagram :). Really any CFG dumping tool would help. |
00:36:07 | FromDiscord | <Elegantbeef> I'm being a bit coy cause I just want to know what that generates 😄 |
00:36:25 | FromDiscord | <Elegantbeef> sourcetrail probably is the closest you'll get to graphical flow control |
00:41:04 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> Ah that'd actually be pretty easy to do in a macro |
01:05:16 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @pedromsluz "Hey, that looks good.": Dear ImGUI |
01:22:33 | FromDiscord | <Elegantbeef> @summarity I got nerdsniped to build the start of this you can finish it 😜 https://play.nim-lang.org/#pasty=SdcRnCWD |
01:31:29 | FromDiscord | <summarity> Excellent, thanks 😄 |
01:40:41 | FromDiscord | <zumi.dxy> Am I not mistaken into thinking I can't put genSym() stuff inside of a `quote do` |
01:40:47 | FromDiscord | <zumi.dxy> (edit) "genSym()" => "`genSym()`" |
01:41:55 | FromDiscord | <zumi.dxy> that's the X;↵the Y is "I want 'private-to-macro' variables inside of a `quote do` |
01:42:00 | FromDiscord | <zumi.dxy> (edit) "do`" => "do`"" |
01:42:49 | FromDiscord | <Elegantbeef> use genast |
01:45:03 | FromDiscord | <zumi.dxy> I'll check it out |
01:45:44 | FromDiscord | <Elegantbeef> You can do like `genast(myVar = genSym(nskVar, "test")): ...` |
01:45:52 | FromDiscord | <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:14 | FromDiscord | <blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=MPjOiOsl |
09:13:39 | FromDiscord | <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:09 | FromDiscord | <jabuci> sent a code paste, see https://play.nim-lang.org/#pasty=XCTfrMsT |
09:14:37 | FromDiscord | <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:50 | FromDiscord | <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:28 | FromDiscord | <jabuci> sent a code paste, see https://play.nim-lang.org/#pasty=mfmzDDsG |
09:54:27 | FromDiscord | <solitudesf> c2nim can't do that. it just converts syntax. you need to post-process c2nim's output. |
09:54:42 | FromDiscord | <solitudesf> use futhark for more automated approach |
10:21:40 | FromDiscord | <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:03 | FromDiscord | <rakgew> so it may depend on the use-case. |
10:27:00 | FromDiscord | <gogolxdong666> There is a niche for Nim which lies in MCP server |
10:29:21 | FromDiscord | <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:57 | FromDiscord | <zumi.dxy> I tried writing PHP with almost vanilla JS↵was maddening trying to sync two different versions of an HTML component |
10:32:55 | FromDiscord | <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:06 | FromDiscord | <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:20 | FromDiscord | <jabuci> sent a code paste, see https://play.nim-lang.org/#pasty=iLZpWEay |
10:41:22 | FromDiscord | <gogolxdong666> I'm using Roo Cline+Claude3.5 sonnet+Claude App client to learn from and extend nimony. |
10:42:27 | FromDiscord | <gogolxdong666> most MCP servers use npx and python |
10:44:01 | FromDiscord | <solitudesf> In reply to @jabuci "And in the REPL": `^` is defined in `math` and requires ffi, which doesn't work in nimvm. |
10:44:44 | FromDiscord | <jabuci> Oh, OK. After `import math` it works. Thanks. |
10:44:54 | FromDiscord | <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:01 | FromDiscord | <solitudesf> (edit) "limitions," => "limitations," |
10:45:54 | FromDiscord | <jabuci> Err, what is the nimvm? For me, nim is a compiler. |
10:50:04 | FromDiscord | <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:36 | FromDiscord | <bendugo> any idea on why this was archived: https://github.com/FedericoCeratto/nim-package-directory |
11:07:47 | FromDiscord | <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:43 | FromDiscord | <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:12 | FromDiscord | <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:38 | FromDiscord | <lainlaylie> for interfacing with c++ libraries. otherwise, use the c backend |
11:47:32 | FromDiscord | <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:53 | FromDiscord | <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:44 | FromDiscord | <zumi.dxy> In reply to @isofruit "So apparently `re` is": is that the pure nim library |
11:49:32 | FromDiscord | <Phil> I think it is (?)↵Seem to me like it's this one: https://github.com/nitely/nim-regex |
11:51:59 | FromDiscord | <Phil> Aaaaand it seems it's not as easy as just migrating to "re2" |
11:53:22 | FromDiscord | <lainlaylie> what's the issue |
11:55:21 | FromDiscord | <Phil> Ah, there we go, prologue needs to update its whole machinery to support the re2 types |
11:55:23 | FromDiscord | <Phil> That was the problem |
11:56:10 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=JBasvPoW |
11:56:32 | FromDiscord | <Phil> addRoute being a prologue proc |
11:56:32 | FromDiscord | <lainlaylie> indeed, re2 returns a different type |
11:56:39 | FromDiscord | <lainlaylie> other than that the interface seems to be identifal |
11:56:46 | FromDiscord | <lainlaylie> i do wonder why they didnt just replace the implementation transparently |
11:57:13 | FromDiscord | <Phil> I'll see what happens if I export all the necessary types and add an addRoute overload |
11:57:20 | FromDiscord | <Phil> Not holding up hope that that'll do it though |
12:01:50 | FromDiscord | <lainlaylie> https://github.com/nitely/nim-regex/blob/master/CHANGELOG.md#v0210 |
12:02:10 | FromDiscord | <lainlaylie> sent a code paste, see https://play.nim-lang.org/#pasty=czBrUSRR |
12:06:11 | FromDiscord | <blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=hHtBRUhW |
12:08:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=DEyvGIhu |
12:08:50 | FromDiscord | <Phil> That... sounds annoying enough for me to not want to bother. |
12:12:04 | FromDiscord | <lainlaylie> In reply to @blashyrk "Is it possible to": how about something like zip from https://github.com/planetis-m/looper |
12:14:57 | FromDiscord | <lainlaylie> https://github.com/beef331/slicerator also has zipIter |
12:17:07 | FromDiscord | <blashyrk> Thanks, I'll give them a shot! |
12:18:20 | FromDiscord | <blashyrk> https://tenor.com/view/crab-rave-dancing-dancing-crab-gif-16543314 |
12:18:22 | FromDiscord | <blashyrk> zip from slicerator works! |
12:18:33 | FromDiscord | <blashyrk> Ugh I thought it would be an inline gif xd |
12:19:43 | FromDiscord | <blashyrk> (edit) "zip" => "zipIter" |
12:21:50 | FromDiscord | <Phil> We don't have a way to rename a symbol on improt/export, do we |
12:22:01 | FromDiscord | <Phil> (edit) "improt/export," => "import/export," |
12:22:14 | FromDiscord | <Phil> I see renaming modules, but not symbols, in the manual |
12:22:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=NjroUmky |
12:55:13 | FromDiscord | <lainlaylie> how about making type aliases and exporting those? |
12:57:20 | FromDiscord | <lainlaylie> though if it were my library I'd just let my users break, it's an easy migration anyway |
13:22:12 | FromDiscord | <Phil> Type alias becomes difficult when you have scenarios such as `var someVar: RegexMatch` |
13:22:50 | FromDiscord | <Phil> This is the kind of stuff that makes updating an application over time intensely annoying |
13:23:47 | FromDiscord | <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:27 | FromDiscord | <fl4shk> What is "BE" short for? |
16:35:37 | FromDiscord | <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:57 | FromDiscord | <lainlaylie> backend? |
17:21:25 | * | beholders_eye joined #nim |
17:46:45 | FromDiscord | <fl4shk> ah gotcha |
17:46:48 | FromDiscord | <fl4shk> that makes more sense |
17:55:10 | * | beholders_eye quit (Quit: WeeChat 4.1.2) |
18:02:23 | FromDiscord | <Elegantbeef> @Phil no there are no import symbol renames, but I don't see how an alias doesn't work |
18:05:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=IBISTdye |
18:05:09 | FromDiscord | <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:08 | FromDiscord | <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:46 | FromDiscord | <heysokam> In reply to @blashyrk "Would it be possible,": are you aware of `{.borrow.}`? |
18:48:01 | FromDiscord | <Elegantbeef> That's the entire point |
18:48:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=jSmfjuWl |
18:48:20 | FromDiscord | <heysokam> ^ |
18:48:45 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> You also can define a converter from your distinct to base so you never decay to the original type suddenly |
18:49:03 | FromDiscord | <Elegantbeef> I mean decay to the distinct |
18:49:03 | FromDiscord | <Elegantbeef> The current usage of distinct is perfect |
18:49:50 | FromDiscord | <heysokam> #2 is what borrow is for |
18:50:05 | FromDiscord | <Elegantbeef> Like I wrapped Opengl GlUints with distinct and I can never accidentally do math operations on them |
18:50:07 | FromDiscord | <Elegantbeef> Why would I want to inherit that 😄 |
18:50:22 | FromDiscord | <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:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=zXJBAfJE |
18:52:13 | FromDiscord | <blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=eDQeRaib |
18:52:35 | FromDiscord | <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:20 | FromDiscord | <Elegantbeef> Cause they have relations to their parent |
18:53:31 | FromDiscord | <Elegantbeef> You cannot do `int(myType)` if you have a `type NotInt = object i: int` |
18:54:12 | FromDiscord | <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:51 | FromDiscord | <heysokam> In reply to @blashyrk "So I can temporarily": or have the base common function take the base common type instead |
18:54:53 | FromDiscord | <Elegantbeef> A converted distinct is a 'R-value' so yes |
18:57:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=gPtNaVEv |
18:58:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=jJdHHUIS |
18:58:13 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> I concur, I'm just going with a "If we must use this tool" |
18:59:36 | FromDiscord | <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:52 | FromDiscord | <Elegantbeef> Then inside my shader loading code instead of passing `isPath` I just have `ShaderFile` and `ShaderPath` I convert a string into |
19:02:52 | FromDiscord | <Elegantbeef> so I can do `loadShader(ShaderFile(staticRead"someShader.vert"), ShaderFile(staticRead"someShader.frag"))` |
19:03:00 | * | ntat joined #nim |
19:05:08 | FromDiscord | <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:29 | FromDiscord | <blashyrk> Thanks, both 🙂 I'll check out vmath |
19:09:46 | FromDiscord | <Elegantbeef> Nah you cannot actually have them take all the operations/functions |
19:09:58 | FromDiscord | <Elegantbeef> It defeats the point of distinctness |
19:10:43 | FromDiscord | <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:56 | FromDiscord | <blashyrk> Yeah that makes sense |
19:12:25 | FromDiscord | <Elegantbeef> Using implicit conversions to the base type then converting back is the 'best' approach |
19:13:06 | FromDiscord | <Elegantbeef> This stops things like `type ValidEmail = distinct string` from doing things like `var someEmail: Email = a & b` |
19:13:14 | FromDiscord | <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:09 | FromDiscord | <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:54 | FromDiscord | <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:07 | FromDiscord | <Elegantbeef> You reinvented distinct, so good job! |
19:26:24 | * | Guest2280 quit (Ping timeout: 252 seconds) |
19:26:27 | FromDiscord | <Elegantbeef> Pure is also a pointless pragma nowadays |
19:26:55 | FromDiscord | <blashyrk> sent a code paste, see https://play.nim-lang.org/#pasty=POsYKhuj |
19:27:17 | FromDiscord | <Elegantbeef> I'll show you |
19:45:43 | FromDiscord | <Elegantbeef> A bit nasty as it needs a single concept, but alas https://play.nim-lang.org/#pasty=KHPxLFhC |
19:46:11 | FromDiscord | <Elegantbeef> You now can define any operations just by converting to a same type |
19:46:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BlJUZBoj |
19:46:56 | FromDiscord | <Elegantbeef> drop the `=` |
19:47:36 | FromDiscord | <Elegantbeef> I still would prefer the vmath method, but you do you |
19:56:14 | FromDiscord | <blashyrk> Thanks! And doubly so for taking the time 🍻 |
21:31:14 | * | ntat quit (Quit: leaving) |
22:27:34 | FromDiscord | <aintea> In reply to @Elegantbeef "Pure is also a": Why does it still exist then ? |
22:28:09 | FromDiscord | <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:56 | FromDiscord | <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:27 | FromDiscord | <zumi.dxy> that would be possible if a language compiler straight up says "pick a version and stick with it forever" |
22:33:40 | FromDiscord | <zumi.dxy> but we know this is to be avoided |
22:34:03 | FromDiscord | <zumi.dxy> so we're... kinda stuck with both outdated and new solutions coexisting |
23:01:07 | FromDiscord | <nieznanymagnat> sent a long message, see https://pasty.ee/qKKgmsIh |
23:10:24 | FromDiscord | <fl4shk> because it's equivalent |
23:10:38 | FromDiscord | <fl4shk> some kinds of CPUs do the same thing :) |
23:10:40 | FromDiscord | <fl4shk> like RISC-V |
23:43:36 | * | alexdaguy joined #nim |