00:04:37 | FromDiscord | <ieltan> In reply to @avahe "The video? Yeah he": Wouldn't bet on it tbh |
00:05:15 | FromDiscord | <Prestige> Yeah, we'll see |
00:32:06 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4Cov |
00:33:25 | FromDiscord | <michaelb.eth> building the static lib on macOS seems broken w.r.t. `libui-ng` itself, fwiw |
01:42:33 | * | lfanew joined #nim |
01:49:42 | * | lfanew quit (Changing host) |
01:49:42 | * | lfanew joined #nim |
01:49:53 | * | lfanew left #nim (#nim) |
01:50:19 | * | lfanew joined #nim |
02:38:05 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
02:49:52 | * | ajunior joined #nim |
02:57:16 | NimEventer | New thread by Ward: Dark Theme Problem in Nim Manual, see https://forum.nim-lang.org/t/10376 |
03:51:01 | FromDiscord | <.kanaxa> In reply to @isofruit "If you want I": Ooooh this is quite nice - it's a static site generator of sorts, for books? |
03:51:16 | FromDiscord | <.kanaxa> Speaking of books, I've been reading Dr Salewski's Nim book |
03:51:29 | FromDiscord | <.kanaxa> Content-wise it's good, but the good doctor really needs an editor |
03:51:52 | FromDiscord | <.kanaxa> Very verbose,aand a lot of verbiage that could be cut down (while still maintaining the conversational tone) |
03:52:16 | FromDiscord | <.kanaxa> And I'm saying that as a lawyer who has to suffer through legalese and verbiage constantly |
03:54:18 | FromDiscord | <.kanaxa> In reply to @michaelb.eth "came back to this": I tried libui-ng yesterday as well, it''s definitely native looking |
03:54:43 | FromDiscord | <.kanaxa> Am very keen on writing a quick app just to see how writing a utility GUI app in Nim on Windows/Mac/Linux feels |
04:03:53 | FromDiscord | <michaelb.eth> In reply to @.kanaxa "Am very keen on": go 4 it, and let us know how it goes! |
04:09:38 | FromDiscord | <Phil> In reply to @.kanaxa "Ooooh this is quite": Yeah sorta.↵Here some nimibook examples:↵https://can-lehmann.github.io/owlkettle/docs/tutorial.html↵https://norm.nim.town/models.html |
04:11:30 | FromDiscord | <Elegantbeef> I even embed my writeups in my website using iframes and nimib 😄 |
04:12:14 | FromDiscord | <Elegantbeef> Don't know how nice the experience is, but meh |
04:14:58 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Don't know how nice": Doesn't sound great for accessibility tools |
04:15:32 | FromDiscord | <Elegantbeef> Do iframes break accessibility tooling? |
04:15:57 | FromDiscord | <Chronos [She/Her]> Oh wait iframes not canvas |
04:16:09 | FromDiscord | <Chronos [She/Her]> Okay then I'm guessing it should be fine on that part? |
04:16:27 | FromDiscord | <Chronos [She/Her]> In reply to @yu.vitaqua.fer.chronos "Oh wait iframes not": My sleep deprivation is a problem I'm not gonna be fixing, sorry :p |
04:21:09 | FromDiscord | <Chronos [She/Her]> I'm currently wondering on how I should handle the abstraction of data for my backend hm... I'm probably gonna want macros and custom types for constraints and for making it integrate with Nim types nicely anyway |
04:21:14 | FromDiscord | <Chronos [She/Her]> Painful but oh well |
04:22:07 | FromDiscord | <Chronos [She/Her]> For now I'll just manually make encoders/decoders for serialising and deserialising data |
04:22:29 | FromDiscord | <Chronos [She/Her]> ...hm |
04:22:52 | FromDiscord | <Chronos [She/Her]> To be fair, for a proof of concept, hardcoding the data in is fine |
04:23:44 | FromDiscord | <.kanaxa> https://scripter.co/nim-deploying-static-binaries/ |
04:23:54 | FromDiscord | <.kanaxa> Article on Nim with musl-libc |
04:26:19 | FromDiscord | <.kanaxa> Wasn't reading it for that, actually stumbled on it while looking for Nimscript stuff |
04:27:18 | FromDiscord | <.matrixagent> In reply to @.kanaxa "Article on Nim with": i mean, why? |
04:27:55 | FromDiscord | <.kanaxa> According to the author, something about getting around deployment dependency issues with glibc versions |
04:28:06 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "i mean, why?": I believe one use is avoiding incompatible versions of musl or glibc from being an issue |
04:28:15 | FromDiscord | <.kanaxa> But I find that odd |
04:28:34 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "I believe one use": cant you link glibc static? |
04:28:37 | FromDiscord | <Chronos [She/Her]> Also statically compiling stuff tends to be slightly faster only because you aren't delegating the calls to the dll stuff which the OS handles |
04:29:08 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "cant you link glibc": shrug never done it myself, it probably is something about the output size? Maybe musl is smaller than glibc or something |
04:29:39 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "*shrug* never done it": why does that even matter |
04:29:47 | FromDiscord | <.matrixagent> unless your targeting embedded |
04:30:05 | FromDiscord | <.matrixagent> we live in an age where we ship whole browsers for a single app |
04:30:08 | FromDiscord | <Chronos [She/Her]> Also musl isn't stuck with a ton of legacy cruft since it's younger I think |
04:30:26 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "Also musl isn't stuck": musl is slower than glibc |
04:30:39 | FromDiscord | <.matrixagent> its within inferior quality thats for sure |
04:30:51 | FromDiscord | <Chronos [She/Her]> The cleaner codebase makes up for it |
04:30:59 | FromDiscord | <.matrixagent> its slower |
04:31:04 | FromDiscord | <Chronos [She/Her]> Glibc has inline ASM which is why it's faster |
04:31:10 | FromDiscord | <Chronos [She/Her]> Speed isn't everything, you know |
04:31:18 | FromDiscord | <.matrixagent> it pretty much is for me |
04:31:25 | FromDiscord | <Chronos [She/Her]> The quality of the product is much, much more important |
04:31:40 | FromDiscord | <.matrixagent> the users dont care about quality |
04:31:43 | FromDiscord | <Chronos [She/Her]> I'd rather a working, slower product than a shoddy barely working faster product |
04:31:47 | FromDiscord | <.matrixagent> if your app is laggy they wont even give it a shot |
04:32:10 | FromDiscord | <Chronos [She/Her]> Which is why you strike a happy medium |
04:32:19 | FromDiscord | <.matrixagent> agreed |
04:32:23 | FromDiscord | <Chronos [She/Her]> But... The difference isn't noticable with musl and glibc's speed |
04:33:08 | FromDiscord | <Chronos [She/Her]> And again, maintainability is better with musl (in their codebase) because, again, less legacy cruft and ASM |
04:33:48 | FromDiscord | <.matrixagent> i mean let me show you a simple video why speed matters |
04:33:53 | FromDiscord | <.matrixagent> just watch 30 seconds |
04:34:26 | FromDiscord | <Chronos [She/Her]> I'm not saying speed doesn't matter |
04:34:42 | FromDiscord | <Chronos [She/Her]> I'm saying that the difference isn't noticable in practice |
04:34:49 | FromDiscord | <.matrixagent> https://youtu.be/9cLJqu4ha34?t=451 |
04:34:57 | FromDiscord | <Chronos [She/Her]> You shave off a few microseconds here and there, that doesn't exactly do much |
04:35:00 | FromDiscord | <.matrixagent> ryujinx is with C# and yuzu is with C++ |
04:35:03 | FromDiscord | <.matrixagent> the performance is huge |
04:35:07 | FromDiscord | <.matrixagent> 20 fps diff |
04:35:37 | FromDiscord | <.matrixagent> o wait wrong video |
04:35:43 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "https://youtu.be/9cLJqu4ha34?t=451": This talks about Vulkan vs OpenGL |
04:35:54 | FromDiscord | <.matrixagent> yup wrong vid |
04:35:57 | FromDiscord | <.matrixagent> gimme a min |
04:36:05 | FromDiscord | <Chronos [She/Her]> OpenGL is much higher level and hides stuff while Vulkan is very "do it yourself" |
04:36:07 | FromDiscord | <Chronos [She/Her]> Aight |
04:36:33 | FromDiscord | <.matrixagent> https://youtu.be/f4Wt-PnBAUQ?t=149 |
04:36:34 | FromDiscord | <.matrixagent> this |
04:37:18 | FromDiscord | <.matrixagent> https://youtu.be/ba5esrsqVF4?t=24 |
04:37:29 | FromDiscord | <.matrixagent> here is a benchmark for a newer game that really shows the diff |
04:38:42 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "https://youtu.be/f4Wt-PnBAUQ?t=149": Majorly different implementations, makes sense they'd have a difference in quality |
04:38:59 | FromDiscord | <.matrixagent> yeah but also one is in C# and one is in C++ |
04:39:13 | FromDiscord | <.matrixagent> in C++ you can squeeze as much perfomance as possible |
04:39:43 | FromDiscord | <.matrixagent> its also impressive that C# can reach this level of performance with an optimizing interpreter |
04:40:33 | FromDiscord | <Chronos [She/Her]> Exactly |
04:41:24 | FromDiscord | <Chronos [She/Her]> You're still missing my point in the first place though, in production, unless every microsecond matters, you're not going to see or have an issue with the lib impl |
04:41:43 | FromDiscord | <.matrixagent> i mean it heavly depends on what your making |
04:41:46 | FromDiscord | <Chronos [She/Her]> And they're also designed for different things to, musl being designed to be easy to statically link to |
04:41:51 | FromDiscord | <.matrixagent> sometimes microseconds mean everything |
04:41:58 | FromDiscord | <.matrixagent> sometimes it literally means nothing |
04:42:13 | FromDiscord | <Chronos [She/Her]> For a game or even the average application, you won't notice |
04:42:23 | FromDiscord | <Festive> How do I ask for input inline? |
04:42:37 | FromDiscord | <Chronos [She/Her]> That's why people use massive engines or as you said, shipping browsers for their apps |
04:42:38 | FromDiscord | <Festive> readLine(stdin) does it on the next line |
04:42:47 | FromDiscord | <.matrixagent> a game you would most certainly notice ms chronos |
04:43:05 | FromDiscord | <Chronos [She/Her]> In reply to @Festive "readLine(stdin) does it on": What do you mean? |
04:43:10 | FromDiscord | <.matrixagent> thats why the C# garbage collector has some serious optimizations under the hood |
04:43:16 | FromDiscord | <lfanew> In reply to @Festive "readLine(stdin) does it on": does it? you might just be writing a newline on your input "prompt" |
04:43:23 | FromDiscord | <lfanew> try using write instead of echo or writeline |
04:43:28 | FromDiscord | <Festive> In reply to @yu.vitaqua.fer.chronos "What do you mean?": echo "[#] Do you want to hide console? [Y/N]: "↵var consoleHide = readLine(stdin) |
04:43:41 | FromDiscord | <Festive> I want it to be on the same line |
04:43:41 | FromDiscord | <lfanew> In reply to @Festive "echo "[#] Do you": echo is appending the newline, not readline |
04:43:53 | FromDiscord | <Festive> In reply to @lfanew "echo is appending the": so how do I not append a newline |
04:44:02 | FromDiscord | <Chronos [She/Her]> yeah, use `stdout.write "text"` |
04:44:24 | FromDiscord | <.matrixagent> In reply to @lfanew "echo is appending the": cant you override it like python? |
04:44:51 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "a game you would": Okay, count one second for me right now |
04:44:57 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "Okay, count one second": done |
04:45:06 | FromDiscord | <Festive> Thanks, that's what I needed |
04:45:10 | FromDiscord | <Festive> Now it's all pretty and compact 😉 |
04:45:13 | FromDiscord | <lfanew> if you can it's not very apparent in docs |
04:45:29 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "done": Times that by 1000 and you get a millisecond |
04:45:37 | FromDiscord | <Chronos [She/Her]> In reply to @lfanew "if you can it's": Echo doesn't have that, no |
04:45:45 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "Times that by 1000": uh? |
04:45:55 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "uh?": 1000 ms |
04:45:55 | FromDiscord | <.matrixagent> 1 second 1000 isnt a millisecond |
04:46:28 | FromDiscord | <Chronos [She/Her]> Sorry I'm running on fumes atm, but if you times a second by 1000, you get 1000 ms |
04:46:32 | FromDiscord | <Chronos [She/Her]> Times that again by 1000 |
04:46:35 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "1000 ms": and? in game dev a gc pause of 500 ms is a skipped fps |
04:46:38 | FromDiscord | <jakraes> What type does type() return? If that even makes sense lol |
04:46:46 | FromDiscord | <.matrixagent> but it wont matter since the gc wont run every fps |
04:46:53 | FromDiscord | <Chronos [She/Her]> And now you have 1000000 microseconds, can you tell me you can count every microsecond? |
04:47:39 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "And now you have": ms you know that yesterday how we had an argument about malloc being slow when the ram acess time is in nano seconds and the allocation is probably under 10 ms |
04:48:21 | FromDiscord | <.matrixagent> in real time computing like games and emulators even 300 ms matters |
04:48:43 | FromDiscord | <Chronos [She/Her]> In reply to @jakraes "What type does type()": A typedesc, from what it seems like |
04:48:47 | FromDiscord | <.matrixagent> seriously a game isnt much different in real time than a trading server |
04:49:09 | FromDiscord | <jakraes> In reply to @yu.vitaqua.fer.chronos "A typedesc, from what": 🫡 Thank you, I'll see if that works |
04:49:21 | FromDiscord | <Elegantbeef> `type` is the old version of `typeof` |
04:49:24 | FromDiscord | <Chronos [She/Her]> I genuinely can't see how 500 microseconds would be an issue in production really |
04:49:40 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "I genuinely can't see": then you havent written anything real time |
04:49:48 | FromDiscord | <Elegantbeef> Lol |
04:49:56 | FromDiscord | <Elegantbeef> 500 us is nothing |
04:50:06 | FromDiscord | <.matrixagent> In reply to @Elegantbeef "500 us is nothing": sure says the guy who says malloc is slow |
04:50:11 | FromDiscord | <.matrixagent> 😉 |
04:50:22 | FromDiscord | <Chronos [She/Her]> You're right, I haven't, I legit can't wrap my head around the fact 500 microseconds would matter, which is why I'm insistent on this |
04:50:58 | FromDiscord | <Chronos [She/Her]> Look at Minecraft, they certainly don't care for every microsecond :p |
04:51:04 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "You're right, I haven't,": i mean, can you imagine a fighter jet having a computer delay about 100ms when its traveling at the speed of sound and its trying to fire at something |
04:51:18 | FromDiscord | <.matrixagent> its unacceptable |
04:51:52 | FromDiscord | <.kanaxa> 1. When compiling, the Nim compiler accepts this switch/flag: `--app:console|gui|lib|staticlib` ↵↵2. I can see how the `lib` flag is used for generating shared libraries, but what is the `gui` flag for? I've been able to build `libui-ng` apps without that flag, what does it do? |
04:51:55 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "i mean, can you": That's a different scenario in where every microsecond counts, games are very much not fighter jets travelling at the speed of sound lol |
04:52:06 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "That's a different scenario": sure and wait |
04:52:16 | FromDiscord | <Chronos [She/Her]> In reply to @.kanaxa "1. When compiling, ": Genuinely no idea, sorry, surely the docs say something? |
04:52:20 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "Look at Minecraft, they": minecraft java is inferior compared to bedrock |
04:52:31 | FromDiscord | <huantian> woah |
04:52:33 | FromDiscord | <huantian> you just like |
04:52:38 | FromDiscord | <.matrixagent> thats even with java having a parralel GC and pre allocating heap size too |
04:52:38 | FromDiscord | <huantian> angered the entire internet with that statement |
04:52:58 | FromDiscord | <.matrixagent> In reply to @huantian "angered the entire internet": in performance, its the truth |
04:53:02 | FromDiscord | <huantian> you gotta specify performance |
04:53:19 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "minecraft java is inferior": MC Bedrock was made in C++/C# (idk which one) purely because mobile devices especially are much, much less weaker than your PC, and Java edition has jank code |
04:53:22 | FromDiscord | <huantian> in literally every other aspect that matters when I play minecraft your statment is wrong |
04:53:42 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "MC Bedrock was made": yes C++, no java is just not made for what they are trying to do |
04:53:45 | FromDiscord | <.matrixagent> look at project zomboid |
04:53:51 | FromDiscord | <.matrixagent> the lag spikes are insane |
04:54:04 | FromDiscord | <.matrixagent> and they even use a hyper tuned GC with a crazy llvm based JIT |
04:54:19 | FromDiscord | <Festive> sent a long message, see http://ix.io/4Cp9 |
04:55:05 | FromDiscord | <xtrayambak> In reply to @Festive "What's clr.nim(220)": Are you using C#? |
04:55:19 | FromDiscord | <Festive> Im using nim, but im trying to run a C# program |
04:55:24 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "yes C++, no java": More like they have so much old code bogging it down, it's a known fact that Java Edition has poor performance, it's why performance mods exist |
04:55:26 | FromDiscord | <xtrayambak> What? |
04:55:29 | FromDiscord | <xtrayambak> How? |
04:55:44 | FromDiscord | <xtrayambak> afaik Nim can't understand CLR code |
04:55:52 | FromDiscord | <Chronos [She/Her]> In reply to @Festive "Im using nim, but": Loading C# dlls work differently btw afaik |
04:55:54 | FromDiscord | <.matrixagent> In reply to @yu.vitaqua.fer.chronos "More like they have": optifine which boosts minecraft performance is using C++ and jni iirc 😄 |
04:55:59 | FromDiscord | <Chronos [She/Her]> They use a completely different format |
04:56:04 | FromDiscord | <lfanew> In reply to @.kanaxa "1. When compiling, ": I think the GUI flag is useful for GUI application builds because it'll do things like prevent a console from opening when you're running your app. That's about as best of a reason I can think of |
04:56:05 | FromDiscord | <huantian> In reply to @.matrixagent "optifine which boosts minecraft": optifine? nah |
04:56:06 | FromDiscord | <Festive> I think that's why actually |
04:56:09 | FromDiscord | <huantian> wew're past optifine now |
04:56:10 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "optifine which boosts minecraft": JNI is janky and Optifine is horrible for newer versions |
04:56:11 | FromDiscord | <Festive> I run a file that doesn't need dlls and it works fine |
04:56:15 | FromDiscord | <Festive> but the second it requests a dll it just breaks |
04:56:18 | FromDiscord | <.matrixagent> In reply to @huantian "wew're past optifine now": optifine++? |
04:56:19 | FromDiscord | <xtrayambak> In reply to @.matrixagent "optifine which boosts minecraft": Sodium is pure Java and performs better though |
04:56:27 | FromDiscord | <.matrixagent> In reply to @xtrayambak "Sodium is pure Java": link? |
04:56:41 | FromDiscord | <Chronos [She/Her]> Literally grab Sodium, Sodium Extras and Starlight |
04:56:47 | FromDiscord | <huantian> what about lithium |
04:56:49 | FromDiscord | <.matrixagent> from where? |
04:56:52 | FromDiscord | <xtrayambak> In reply to @.matrixagent "optifine++?": https://github.com/CaffeineMC/sodium-fabric |
04:56:53 | FromDiscord | <huantian> and every element ever apparently |
04:56:56 | FromDiscord | <Festive> sent a code paste, see https://play.nim-lang.org/#ix=4Cpa |
04:56:59 | FromDiscord | <Chronos [She/Her]> In reply to @huantian "what about lithium": Lithium also optimises server logic |
04:57:03 | FromDiscord | <Festive> All I know is that it doesn't work with files that have dependancies |
04:57:10 | FromDiscord | <Festive> (edit) "All I know is that it doesn't work with files that have ... dependancies" added "external" |
04:57:11 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "from where?": CurseForge, GitHub and Modrinth have them |
04:57:16 | FromDiscord | <Festive> (edit) "dependancies" => "dependencies" |
04:57:20 | FromDiscord | <.matrixagent> In reply to @xtrayambak "https://github.com/CaffeineMC/sodium-fabric": intresting |
04:57:22 | FromDiscord | <jakraes> Sodium is currently the best fps booster for java minecraft, optifine is falling behind super fast |
04:57:26 | FromDiscord | <huantian> modrith is the place to be for these mods tho |
04:57:30 | FromDiscord | <xtrayambak> In reply to @yu.vitaqua.fer.chronos "Literally grab Sodium, Sodium": Perhaps we're going too offtopic 😅 |
04:57:31 | FromDiscord | <jakraes> Facts |
04:57:34 | FromDiscord | <huantian> or github |
04:57:34 | FromDiscord | <Chronos [She/Her]> Modrinth is great |
04:57:34 | FromDiscord | <.matrixagent> so minecraft java just has garbage code |
04:57:35 | FromDiscord | <huantian> yeah this is very offtopic |
04:57:39 | FromDiscord | <Chronos [She/Her]> In reply to @xtrayambak "Perhaps we're going too": Perhaps lol |
04:57:54 | FromDiscord | <huantian> In reply to @.matrixagent "so minecraft java just": getting better though, iirc starlight is mostly obsolete with 1.20? |
04:57:54 | FromDiscord | <.matrixagent> i dont think anyone minds |
04:57:58 | FromDiscord | <xtrayambak> In reply to @.matrixagent "so minecraft java just": It allocates 200 MB in a second and deallocates it the next frame |
04:57:59 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "so minecraft java just": Yeah, very poor code, could be a good idea to rewrite it in Nim 😛 |
04:58:04 | FromDiscord | <xtrayambak> that should tell you how it runs |
04:58:10 | FromDiscord | <huantian> well we squished out a convo about C# |
04:58:11 | FromDiscord | <huantian> lmao |
04:58:12 | FromDiscord | <Chronos [She/Her]> In reply to @.matrixagent "i dont think anyone": The fact mods exist for this shows people do mind lol |
04:58:23 | FromDiscord | <Chronos [She/Her]> In reply to @huantian "getting better though, iirc": Yeah, slowly tho |
04:58:24 | FromDiscord | <huantian> In reply to @huantian "getting better though, iirc": so vanilla code is getting better |
04:58:27 | FromDiscord | <.matrixagent> In reply to @xtrayambak "It allocates 200 MB": man yesterday i was playing minecraft + some modpack and the allocation was 600mb/s |
04:58:29 | FromDiscord | <.matrixagent> its insane |
04:58:30 | FromDiscord | <Festive> In reply to @huantian "well we squished out": 😭 |
04:58:32 | FromDiscord | <Chronos [She/Her]> Oh shit yeah lmao, lets move to #offtopic |
04:58:36 | FromDiscord | <.matrixagent> sure |
04:58:53 | FromDiscord | <xtrayambak> In reply to @yu.vitaqua.fer.chronos "Yeah, very poor code,": Lettuce storm Mojang headquarters and protest |
04:58:55 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Cpb |
04:59:03 | FromDiscord | <xtrayambak> "We want Nim! We want Nim!" |
04:59:19 | FromDiscord | <Chronos [She/Her]> In reply to @xtrayambak "Lettuce storm Mojang headquarters": Lol modding community would have an uproar |
04:59:33 | FromDiscord | <Festive> In reply to @yu.vitaqua.fer.chronos "Sorry aha, I don't": 💀 neither do I im just working off scraps I found on the internet |
04:59:40 | FromDiscord | <xtrayambak> Most of the modding community probably doesn't know what a Nim is |
04:59:57 | FromDiscord | <Festive> I dont get why a file needing a dll just breaks it |
05:00:00 | FromDiscord | <Chronos [She/Her]> In reply to @Festive "💀 neither do": Fair enough lmao |
05:00:05 | FromDiscord | <xtrayambak> Hell, most of the programming community doesn't |
05:00:17 | FromDiscord | <Chronos [She/Her]> In reply to @Festive "I dont get why": Perhaps it's something to do with memory management? |
05:00:29 | FromDiscord | <Festive> In reply to @yu.vitaqua.fer.chronos "Perhaps it's something to": Probably, since the file is in memory it must do some wonky stuff |
05:00:32 | FromDiscord | <xtrayambak> In reply to @yu.vitaqua.fer.chronos "Perhaps it's something to": C# is garbage collected but uses a different GC strat |
05:00:34 | FromDiscord | <Chronos [She/Her]> In reply to @xtrayambak "Hell, most of the": Yeaaah lol |
05:00:40 | FromDiscord | <xtrayambak> perhaps that's conflicting with the Nim GC? |
05:00:50 | FromDiscord | <Festive> which one does C# use? |
05:00:54 | FromDiscord | <xtrayambak> But that'd likely throw a SIGSEGV pointing to gc.nim |
05:00:54 | FromDiscord | <Chronos [She/Her]> In reply to @xtrayambak "perhaps that's conflicting with": Was boutta say, yeah that may be it |
05:00:54 | FromDiscord | <Festive> I can compile with the same one |
05:00:56 | FromDiscord | <Festive> maybe that will fix |
05:01:09 | FromDiscord | <Chronos [She/Her]> In reply to @Festive "which one does C#": Their own implementation unsupported by Nim lol |
05:01:14 | FromDiscord | <Festive> bruh |
05:01:15 | FromDiscord | <Festive> 💀 |
05:01:37 | FromDiscord | <Chronos [She/Her]> You could probably try messing with the GC on Nim's side but I wouldn't know really |
05:02:03 | FromDiscord | <Festive> I'm not rewriting the entire language to make one program work |
05:02:21 | FromDiscord | <xtrayambak> In reply to @Festive "I'm not rewriting the": Just the garbage collector |
05:02:23 | FromDiscord | <Chronos [She/Her]> Look at `GC_ref` in system.nim, maybe? |
05:02:24 | FromDiscord | <xtrayambak> Not the entire languahe |
05:02:28 | FromDiscord | <xtrayambak> (edit) "languahe" => "language" |
05:02:50 | FromDiscord | <Festive> In reply to @yu.vitaqua.fer.chronos "Look at `GC_ref` in": Marks the object x as referenced, so that it will not be freed until it is unmarked via GC_unref. If called n-times for the same object x, n calls to GC_unref are needed to unmark x. Source Edit |
05:03:12 | FromDiscord | <Festive> So if I use this on an object, nim's gc won't touch it ? |
05:03:17 | FromDiscord | <Elegantbeef> What? |
05:03:24 | FromDiscord | <Festive> Im not sure |
05:03:32 | FromDiscord | <Festive> I have no clue about the internal workings of nimlang |
05:03:38 | FromDiscord | <Festive> Im just guessing |
05:03:47 | FromDiscord | <Chronos [She/Her]> In reply to @Festive "What's clr.nim(220)": Beef look here |
05:04:17 | FromDiscord | <Festive> Im trying to run C#, but whenever a file requires a DLL, it just breaks with that error |
05:04:22 | FromDiscord | <Festive> (edit) "breaks" => "quits" |
05:04:27 | FromDiscord | <Chronos [She/Her]> My guess it's probably the GC in Nim and C# not playing nicely with eachother since festive mentioned native libs crash it |
05:05:25 | FromDiscord | <elegantbeef> Bridge is not having any of it |
05:05:26 | FromDiscord | <Elegantbeef> The hell are you guys talking about |
05:05:32 | FromDiscord | <dowylju> sent a code paste, see https://play.nim-lang.org/#ix=4Cpd |
05:05:34 | FromDiscord | <lfanew> I don't do much C#, but wouldn't the C# managed code run under a different runtime outside of Nim? They shouldn't conflict |
05:05:40 | FromDiscord | <elegantbeef> Indeed |
05:05:49 | FromDiscord | <lfanew> Like under CLR or whatever they call theirs |
05:05:50 | FromDiscord | <elegantbeef> The only confliction is if you are passing data from Nim to the C# |
05:05:59 | FromDiscord | <elegantbeef> Or vice versa |
05:06:07 | FromDiscord | <Festive> In reply to @Elegantbeef "The hell are you": I'm executing a C# executable using nimlang in memory. ↵When I do so, if the C# executable isn't 100% native and requests a DLL from somewhere, it results in that error that you saw before, from clr.nim. |
05:06:10 | FromDiscord | <elegantbeef> GC'd memory cannot be passed safely |
05:06:30 | FromDiscord | <elegantbeef> Probably an issue with incorrect paths or similar |
05:06:35 | FromDiscord | <Phil> In reply to @Elegantbeef "`newStmtList(myCode)`": From what I'm seeing, newStmtList requires me to throw in the body in an AST Form to create the NimNode.↵That's 40 lines or so of nim code, I'd really like to not have to provide them in AST Form.↵I'll see how else I can get around this |
05:06:50 | FromDiscord | <elegantbeef> What? |
05:07:25 | FromDiscord | <Festive> first time ive seen beef on discord |
05:07:44 | FromDiscord | <Phil> Back then we were talking about how stuff generated via `newCall` can't take in a body parameter that is basically a code-block the same way templates and macros can |
05:08:12 | FromDiscord | <elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Cpe |
05:08:40 | FromDiscord | <Festive> In reply to @elegantbeef "Probably an issue with": In the executable? |
05:08:49 | FromDiscord | <Festive> or in the nim program |
05:08:54 | FromDiscord | <elegantbeef> Probably the C# code or w/e |
05:09:01 | FromDiscord | <elegantbeef> Sounds like malware though, so stop it get some help |
05:09:36 | FromDiscord | <Festive> Im just trying to see if I can fix some code I found on github that didn't fully work |
05:09:42 | FromDiscord | <Festive> https://github.com/icyguider/Nimcrypt2 |
05:10:36 | FromDiscord | <.kanaxa> In reply to @lfanew "I think the GUI": Oh, good point! Must be why Windows opens a console on running the executable |
05:10:48 | FromDiscord | <lfanew> In reply to @dowylju "Hello sorry to interrupt": quite a few strats for these kinds of things depending on your situation. i prefer zmq cause there's already a lib for it. other fun ways you can do this is shared files on filesystem, unix sockets, and more |
05:11:14 | FromDiscord | <lfanew> (edit) "In reply to @dowylju "Hello sorry to interrupt": quite a few strats for these kinds of things depending on your situation. i prefer zmq cause there's already a lib ... for" added "(https://github.com/nim-lang/nim-zmq)" |
05:12:53 | FromDiscord | <Phil> facepalm↵Now I understand why my newCall call blows up, not all my varargs are NimNodes |
05:13:15 | FromDiscord | <dowylju> I'm looking at the zmq one and it seems to use a server/client. Would this be too much, the child will always be started by the parent. |
05:13:36 | FromDiscord | <dowylju> I might misunderstand something because I'm still new to Nim |
05:14:13 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Cpf |
05:14:48 | FromDiscord | <lfanew> In reply to @dowylju "I'm looking at the": Too much in what way are you thinking? |
05:15:53 | FromDiscord | <dowylju> I was thinking that just reading from stdin would be easier (faster?) than using a server style setup |
05:16:54 | FromDiscord | <dowylju> and the child process always is started from the parent, not seperately |
05:17:00 | FromDiscord | <lfanew> is this a one way, one-shot pass of data from parent to child? or will it be constant data between them? |
05:17:08 | FromDiscord | <dowylju> Constant data |
05:17:26 | FromDiscord | <elegantbeef> In reply to @isofruit "Wait a second, is": of course |
05:17:30 | FromDiscord | <elegantbeef> The nimnodes will be placed as is |
05:17:50 | FromDiscord | <lfanew> yeah i'd reach for some kinda IPC strat then. if that isn't sufficient you could look at threading models but i'm not too keen on threading in nim |
05:17:59 | FromDiscord | <lfanew> (edit) "keen" => "wise" | "wiseon ... threadingworks" added "how" | "onhowthreading ... in" added "works" |
05:18:29 | FromDiscord | <dowylju> OK, thank you |
05:19:07 | FromDiscord | <elegantbeef> It's quite odd that `inputstream` doesnt work properly |
05:19:32 | FromDiscord | <Phil> In reply to @elegantbeef "The nimnodes will be": In that case, given that at my origin macro in which I call my `seq[Parameter]` is not a NimNode:↵How do I turn it into one?↵And given that I need to iterate over the contents of `seq[Parameter]` to make a `nnkFormalParams` node, how do I unpack my `seq[Parameter]` from a NimNode once `generateAnonProc` has received it as Nimnode? |
05:19:33 | FromDiscord | <elegantbeef> Regardless how odd it'd be to use stdin like this, it should work |
05:19:40 | FromDiscord | <lfanew> if it's a pretty simple program you can approach it with a file they both use, just be careful to free the file handle is all. if one's only read then that's no biggie |
05:19:46 | FromDiscord | <elegantbeef> `seq[Parameter]` is a Nim Node |
05:19:55 | FromDiscord | <elegantbeef> if it's not `static` it's a NimNode |
05:20:05 | FromDiscord | <Phil> it`s static seq[Parameter] specifically so that it isn't |
05:20:16 | FromDiscord | <elegantbeef> Well then you need to do `newLit seq[Parameter]` |
05:20:27 | FromDiscord | <elegantbeef> sorry `newLit yourSeq` |
05:20:42 | FromDiscord | <dowylju> The use case is: to update a ASCII graphic from a child process |
05:22:24 | FromDiscord | <elegantbeef> lfanew is there a reason you sent me a friend request even though we have not spoken? 😄 |
05:23:05 | FromDiscord | <lfanew> In reply to @dowylju "The use case is:": Got ya. Yeah I see what you mean like maybe child could just get stdin from parent, but they are two separate processes still and process isolation limits interaction. being the parent only grants a few cool things like sending signals and what not |
05:23:18 | FromDiscord | <lfanew> yeah i was gonna try to sell you some essential oils lol |
05:23:26 | FromDiscord | <elegantbeef> Damn I'm missing out |
05:23:28 | FromDiscord | <lfanew> no i have no idea how i did that probably scrolling past all the offtopic stuff back and forth |
05:23:39 | FromDiscord | <elegantbeef> Would be cooler if you had an MLM for me to join |
05:24:03 | FromDiscord | <lfanew> this can be the start of one at least. get two more in and you're set yourself |
05:24:18 | FromDiscord | <elegantbeef> Inverted funnel! |
05:25:02 | FromDiscord | <dowylju> I'm only having trouble getting the child to get output from the parent. |
05:26:52 | FromDiscord | <Phil> Okay the fact that macros can't turn types into static strings is becoming mildly irritating |
05:27:18 | FromDiscord | <elegantbeef> Well you know what static means right? 😄 |
05:27:38 | FromDiscord | <Phil> I mean a typedesc, not a type of an instnace |
05:27:41 | FromDiscord | <Phil> (edit) "instnace" => "instance" |
05:27:43 | FromDiscord | <elegantbeef> Same thing |
05:27:50 | FromDiscord | <Festive> I think I figured out my issue |
05:27:52 | FromDiscord | <elegantbeef> A macro is only semantically checked once |
05:28:01 | FromDiscord | <Phil> Like, why is $MyType not doable statically in macros but in procs it works? |
05:28:11 | FromDiscord | <elegantbeef> Cause macros only have a single instance |
05:28:21 | FromDiscord | <Phil> so I outsource that code into a proc and I'm gucci? |
05:28:38 | FromDiscord | <Phil> no wait, can't, I accept typedescs as untyped,ugh |
05:28:43 | FromDiscord | <elegantbeef> Into another delayed macro |
05:29:57 | FromDiscord | <elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Cpj |
05:39:30 | FromDiscord | <elegantbeef> @Phil What's this macro actually doing though? |
05:45:38 | * | azimut quit (Ping timeout: 240 seconds) |
05:48:10 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Cpr |
05:48:41 | FromDiscord | <Phil> (edit) "http://ix.io/4Cpr" => "http://ix.io/4Cps" |
05:49:51 | FromDiscord | <Phil> (edit) "http://ix.io/4Cps" => "http://ix.io/4Cpt" |
05:50:30 | FromDiscord | <Phil> The reason why the body can be identical is that I generate different assignment statements based on `specialMappingOperations` , so it's not that my code needs to access them, the user can if needed |
05:51:28 | FromDiscord | <Phil> Ugh maybe I should just drop the project, I'm sure it's doable with a DSL to generate the assignment-statements the user wants in a far more beautiful way in some manner but I'm lacking in macro experience to get there |
05:54:03 | FromDiscord | <Elegantbeef> I still just make some helper procs and standardised trait |
05:54:57 | FromDiscord | <Phil> How hard is learning to write a DSL in nim?↵Actually how do you even write one? |
05:55:13 | FromDiscord | <Elegantbeef> You take in untyped ast then emit what you want |
05:56:48 | FromDiscord | <Phil> Hmmm i have a pretty limited set of assignment operations I want to be able to make |
05:56:56 | FromDiscord | <Phil> So let me think |
06:00:46 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Cpy |
06:01:00 | FromDiscord | <Phil> (edit) "http://ix.io/4Cpy" => "http://ix.io/4Cpz" |
06:01:22 | FromDiscord | <Phil> (edit) "http://ix.io/4Cpz" => "http://ix.io/4CpA" |
06:01:23 | FromDiscord | <Phil> That seems... manageable in scope |
06:01:24 | FromDiscord | <Phil> (edit) "scope" => "scope?" |
06:01:29 | FromDiscord | <Phil> (edit) "scope?" => "scope (?)" |
06:01:39 | FromDiscord | <Elegantbeef> Sure, also seems possible without an entire dsl though |
06:02:08 | FromDiscord | <Phil> I mean I tried and I got close to wanting to throw my laptop at a wall at implicit rule number 20 on how to deal with macros in macros in macros |
06:07:29 | * | ntat joined #nim |
06:10:50 | FromDiscord | <.matrixagent> if i want to suggest a feature for the nim compiler where can i do so? |
06:11:12 | FromDiscord | <.matrixagent> do i just open a bug form/request/fix (idk) on the nim compiler repo? |
06:11:57 | FromDiscord | <Elegantbeef> There is the nim-lang/rfc repo |
06:12:07 | FromDiscord | <.matrixagent> link? |
06:12:09 | FromDiscord | <Elegantbeef> But you best actually have a sensible feature and not just "I want X feature from Z language" |
06:12:23 | FromDiscord | <.matrixagent> im going to suggest a compiler flag that only omits C |
06:12:52 | FromDiscord | <Elegantbeef> You mean the one that already exists |
06:12:52 | FromDiscord | <Elegantbeef> `-c` |
06:13:00 | FromDiscord | <.matrixagent> it generates C only? |
06:13:08 | FromDiscord | <Phil> Pretty sure it does |
06:13:17 | FromDiscord | <.matrixagent> i gotta try this |
06:13:18 | FromDiscord | <lfanew> see advanced sect. https://nim-lang.org/docs/nimc.html |
06:13:23 | FromDiscord | <lfanew> all kinds of fun flags |
06:13:54 | FromDiscord | <Phil> The fastest RFC ever, from "This should exist" to "This is implemented" in -x years |
06:14:00 | FromDiscord | <.matrixagent> nope https://media.discordapp.net/attachments/371759389889003532/1137267242162192466/image.png |
06:14:01 | FromDiscord | <Phil> (edit) "-x" => "negative x" |
06:14:24 | FromDiscord | <Elegantbeef> It does |
06:14:30 | FromDiscord | <.matrixagent> wheres it at |
06:14:31 | FromDiscord | <Elegantbeef> `--nimout:./` |
06:14:36 | FromDiscord | <Elegantbeef> or `--nimCache:./` |
06:14:59 | FromDiscord | <.matrixagent> `command line(1, 2) Error: invalid command line option: '--nimout'` |
06:15:15 | FromDiscord | <Elegantbeef> rtfm |
06:15:39 | FromDiscord | <.kanaxa> Out of curiosity, why does this readline work in standard Nim:↵↵let x = readLine(stdin)↵echo "Printing: ", x |
06:16:15 | FromDiscord | <.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4CpF |
06:16:20 | FromDiscord | <.matrixagent> so basiclly i should take the file and stick it |
06:16:22 | FromDiscord | <.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4CpG |
06:17:01 | FromDiscord | <Phil> In reply to @.kanaxa "Out of curiosity, why": nimscript is basically all the code that nim can run at compiletime |
06:17:02 | FromDiscord | <Elegantbeef> Nimscript is a subset of Nim |
06:17:12 | FromDiscord | <Phil> and some bells and whistles added to that baseline |
06:17:25 | FromDiscord | <.kanaxa> In reply to @.kanaxa "Out of curiosity, why": I read the source, it seems to alias back to `readLine` anyway, so I don't get why NimScript doesn't allow `readLine(stdin)` https://media.discordapp.net/attachments/371759389889003532/1137268100681711646/image.png |
06:18:27 | FromDiscord | <.matrixagent> i think im just gonna compile nim from source on my switch and compile from there |
06:18:33 | FromDiscord | <.matrixagent> since thats what i wanna do anyways |
06:18:51 | FromDiscord | <Chronos [She/Her]> In reply to @.kanaxa "I read the source,": The proc there is compiled and made accessible to Nimscript specifically |
06:19:02 | FromDiscord | <Chronos [She/Her]> That's why it's a proc instead of a template for example |
06:19:14 | FromDiscord | <Elegantbeef> Nim's VM overrides some procedures |
06:20:18 | FromDiscord | <.kanaxa> Mmm, I see - so my approach and understanding is correct then, it's an entirely different proc in Nimscript(`readLineFromStdin()`) rather than the usual (`readLine(stdin)`) |
06:20:30 | FromDiscord | <.kanaxa> (edit) "Nimscript(`readLineFromStdin()`)" => "Nimscript (`readLineFromStdin()`)" |
06:20:37 | FromDiscord | <Chronos [She/Her]> Yep, I believe so |
06:21:59 | FromDiscord | <Elegantbeef> Due to the fact the nimvm cannot import C code yes |
06:22:10 | FromDiscord | <Elegantbeef> there is `libffi` which can be enabled but no compiler ships with it enabled |
06:23:31 | FromDiscord | <.matrixagent> what is .magic in nim? |
06:24:05 | FromDiscord | <Elegantbeef> Compiler implemented logic |
06:24:13 | FromDiscord | <.matrixagent> so generics? |
06:24:52 | FromDiscord | <Elegantbeef> No |
06:24:53 | FromDiscord | <Elegantbeef> Compiler implemented logic |
06:25:13 | FromDiscord | <.matrixagent> ...how does the compiler implement logic |
06:25:24 | FromDiscord | <.matrixagent> isnt its job to transpile your code to C or assembky |
06:25:26 | FromDiscord | <.matrixagent> (edit) "assembky" => "assembly" |
06:25:37 | FromDiscord | <Elegantbeef> No the compiler has specific logic for magic procedures for different backends |
06:25:48 | FromDiscord | <.matrixagent> weird |
06:25:58 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4CpI |
06:26:03 | FromDiscord | <Elegantbeef> Nim is not a transpiler it's an entire language that uses C as an IR |
06:26:15 | FromDiscord | <griffith1deadly> (edit) "sent" => "What is the best way to organize sharing of ``ref object`` between threads? ↵the idea is as follows ↵main logical thread creates" | "code paste, see https://play.nim-lang.org/#ix=4CpI" => "packet (network) -> network thread -> some logic↵what is the path without using a channel?" |
06:26:20 | FromDiscord | <.matrixagent> https://en.wikipedia.org/wiki/Nim_(programming_language)#:~:text=Nim%20was%20created%20to%20be,macros%20and%20term%20rewriting%20macros. |
06:26:28 | FromDiscord | <.matrixagent> and also somone might want to edit the nim wikipedia page |
06:26:41 | FromDiscord | <.matrixagent> sent a code paste, see https://play.nim-lang.org/#ix=4CpJ |
06:27:12 | FromDiscord | <Elegantbeef> Don't have cycles and pass them as `sink` griffith |
06:28:04 | FromDiscord | <.matrixagent> fixed the wiki |
06:28:12 | FromDiscord | <Phil> (https://nim-lang.org/docs/destructors.html#move-semantics in case docs are needed) |
06:28:43 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "Don't have cycles and": What if we have cycles? |
06:28:51 | FromDiscord | <Elegantbeef> Don't |
06:29:09 | FromDiscord | <Elegantbeef> Or keep the data in a global variable/seq |
06:29:18 | FromDiscord | <Phil> With a lock? |
06:29:30 | FromDiscord | <_gumbercules> I still wonder if Nimskull is going to do something like: https://www.more-magic.net/posts/internals-gc.html for their GC |
06:29:41 | FromDiscord | <_gumbercules> and ditch the arc/orc stuff |
06:29:53 | FromDiscord | <_gumbercules> I have no idea what's going on with that project anymore |
06:29:56 | FromDiscord | <_gumbercules> and haven't for a while... |
06:30:00 | FromDiscord | <Elegantbeef> I doubt it |
06:30:40 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "Or keep the data": global seq require using lock's↵what way without locks? |
06:31:12 | FromDiscord | <Elegantbeef> There is no way to share cyclical types in a sane way across threads unless you disarm destructors |
06:32:04 | FromDiscord | <_gumbercules> just `allocShared`? and use atomics / locks? |
06:32:07 | FromDiscord | <_gumbercules> or is that not sane? |
06:33:35 | FromDiscord | <_gumbercules> In reply to @Elegantbeef "I doubt it": yeah I'm pretty sure cheney on the MTA still requires thread local heaps |
06:33:48 | FromDiscord | <griffith1deadly> In reply to @_gumbercules "just `allocShared`? and use": as i recall, allocShared seq and use it between thread's cause crash↵i think it need lock for normal working↵what the way without locks? |
06:33:50 | FromDiscord | <_gumbercules> which is one reason Chicken doesn't support hardware threads |
06:34:24 | FromDiscord | <_gumbercules> In reply to @griffith1deadly "as i recall, allocShared": I don't know how you share memory between threads without synchronizing access |
06:34:47 | FromDiscord | <_gumbercules> If you don't need to access the memory on the thread you're calling from, you can move it |
06:35:44 | FromDiscord | <Elegantbeef> And in that case you should just use nim-lang/threading's channels |
06:35:47 | FromDiscord | <_gumbercules> But assuming multiple threads need access to the memory, I'm not aware of any other way than using locks / atomics. And if you're using locks and atomics I wouldn't use seq |
06:35:54 | FromDiscord | <griffith1deadly> In reply to @_gumbercules "If you don't need": I think I need this.↵The idea is that the main thread just creates the object, and another thread interacts with the object |
06:36:06 | FromDiscord | <Elegantbeef> So then why can the other thread not own the object? |
06:36:10 | FromDiscord | <_gumbercules> In reply to @griffith1deadly "I think I need": Yea then just move it to the other thread |
06:36:29 | FromDiscord | <_gumbercules> I believe the procedure is literally called `move` |
06:36:35 | FromDiscord | <Elegantbeef> Either use `std/isolation` or nim-lang/channels to do it |
06:36:46 | FromDiscord | <_gumbercules> or just use locks and atomics 😉 |
06:37:03 | FromDiscord | <Elegantbeef> `ensureMove` is more like it gumber 😄 |
06:37:12 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "Either use `std/isolation` or": channel's just deepCopy object, not? |
06:37:14 | FromDiscord | <Elegantbeef> Don't want an implicit copy |
06:37:19 | FromDiscord | <_gumbercules> channels == message passing |
06:37:21 | FromDiscord | <Elegantbeef> Not nim-lang/threading's |
06:37:44 | FromDiscord | <_gumbercules> and incur the overhead |
06:38:05 | FromDiscord | <_gumbercules> are you avoiding locks out of complexity? |
06:38:14 | FromDiscord | <Elegantbeef> threading's channels use `isolated` data which means the data is a closed cycle and safe to move |
06:38:29 | FromDiscord | <griffith1deadly> In reply to @_gumbercules "are you avoiding locks": yes |
06:38:37 | FromDiscord | <_gumbercules> couldn't you just `createThread` and then `ensureMove` the argument? |
06:38:41 | FromDiscord | <Elegantbeef> Just pass the data using isolated |
06:39:04 | FromDiscord | <Elegantbeef> Assuming isolated works I guess 😄 |
06:39:09 | FromDiscord | <_gumbercules> In reply to @griffith1deadly "yes": yeah - I mean if you don't need the calling thread or any other thread besides the one you're passing the data to, to access that memory you're golden |
06:39:14 | FromDiscord | <_gumbercules> In reply to @Elegantbeef "Assuming isolated works I": bingo |
06:39:43 | FromDiscord | <Elegantbeef> Isolation is a bit better than just moving since the compiler ensures the data is an isolated graph |
06:39:51 | FromDiscord | <_gumbercules> but I've written a lot of multithreaded code and my advice is once you enter this arena the more you understand about concurrency and synchronization the better off you'll be |
06:40:04 | FromDiscord | <_gumbercules> at the end of the day you have tools like asan, valgrind, leak detectors etc |
06:40:11 | FromDiscord | <Elegantbeef> But given I do not multithread, i've not used isolated so have 0 clue how ineffective it is |
06:40:22 | FromDiscord | <_gumbercules> sure there is a ton of nuance and there are many rabbit holes |
06:41:15 | FromDiscord | <_gumbercules> but I also think you'll learn a lot by diving in the deep end - if your goal is to learn. if your'e trying to build something for production by all means do what's safest |
06:41:44 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4CpP |
06:42:11 | FromDiscord | <Elegantbeef> are you in a WSL? |
06:42:38 | FromDiscord | <_gumbercules> They shouldn't need to be |
06:42:55 | FromDiscord | <Elegantbeef> Right but it might detect linux and attempt to call gcc directly |
06:42:58 | FromDiscord | <_gumbercules> Is the MINGW / MSYS2 bin directory on your path? |
06:43:06 | FromDiscord | <Elegantbeef> No clue if mingw installs as gcc on windows |
06:43:13 | FromDiscord | <_gumbercules> it looks like it couldn't find `gcc.exe` |
06:43:15 | FromDiscord | <_gumbercules> it does |
06:43:28 | FromDiscord | <Elegantbeef> Right then path it is 😄 |
06:43:47 | FromDiscord | <_gumbercules> https://media.discordapp.net/attachments/371759389889003532/1137274739149258772/image.png |
06:44:21 | FromDiscord | <Phil> Is there a proc or something that prints me the entire tree that is contained in a specific NimNode? |
06:44:29 | FromDiscord | <_gumbercules> `treeRepr`? |
06:44:30 | FromDiscord | <Elegantbeef> `treeRepr` |
06:44:41 | FromDiscord | <Phil> Perfect! |
06:46:29 | FromDiscord | <Elegantbeef> Eons ago I did make a small nimscripter example to make macros a bit more interactive https://streamable.com/6m5ww1 |
06:47:01 | FromDiscord | <Elegantbeef> No clue if that's something you'd be interested in using, but https://github.com/beef331/nimscripter/tree/master/examples/macrorepl it's here |
06:47:57 | FromDiscord | <Phil> I'll keep it in a tab for now, I'm basically slowly making progress towards getting to a workflow of actually writing macros without wanting to bang my head against a wall |
06:48:04 | FromDiscord | <Phil> Once I have that done I'm looking for better tooling |
06:48:36 | FromDiscord | <Elegantbeef> `repr` and `treeRepr` are just the easiest though |
06:50:40 | FromDiscord | <Elegantbeef> griffith https://forum.nim-lang.org/t/10161#67262 here's reference btw |
06:50:46 | FromDiscord | <Phil> I'm liking astGenRepr so far for it gives me the macro-code that I can use directly and so helps with making the association of "this macro-code maps to this piece of generated nim code" |
06:50:59 | FromDiscord | <Elegantbeef> Ugh |
06:51:10 | FromDiscord | <Elegantbeef> Just use `genast` or `quote do` instead |
06:51:15 | FromDiscord | <Elegantbeef> It's 10000% more maintainable |
06:51:37 | FromDiscord | <Phil> I was about to write myself procs that generate the astGen for a given expression and just call those |
06:51:59 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "griffith https://forum.nim-lang.org/t/10161#67262 h": thanks |
06:52:24 | FromDiscord | <Elegantbeef> it does use channels but that bit can be changed for a `Thread[Isolated[T]]` |
06:52:41 | FromDiscord | <.kanaxa> Nim site seems down currently? https://media.discordapp.net/attachments/371759389889003532/1137276976835592262/image.png |
06:54:44 | FromDiscord | <lfanew> I don't think so, just that page. How'd you arrive to that link? |
06:54:51 | FromDiscord | <.kanaxa> Straight up from Google |
06:55:11 | FromDiscord | <.matrixagent> In reply to @.kanaxa "Nim site seems down": same for me |
06:55:26 | FromDiscord | <.matrixagent> @.kanaxa https://nim-lang.org/1.4.0/io.html |
06:55:27 | FromDiscord | <.matrixagent> works for me |
06:55:28 | FromDiscord | <Elegantbeef> `io` is no longer a module |
06:55:30 | FromDiscord | <lfanew> it's probably just not available on latest (2.0) try https://nim-lang.org/1.6.14/io.html |
06:55:49 | FromDiscord | <.kanaxa> In reply to @lfanew "it's probably just not": Ah, makes sense - yeah the 1.6 is working for me |
06:56:11 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/theindex.html all modules are documented here |
06:56:24 | FromDiscord | <.kanaxa> In reply to @Elegantbeef "https://nim-lang.org/docs/theindex.html *all* modul": Thanks! Haven't seen this one yet |
06:56:42 | FromDiscord | <.kanaxa> As a beginner like me coming to Nim it's quite overwhelming |
06:57:08 | FromDiscord | <.kanaxa> Features are often available, but documented in patches and strewn everywhere |
06:57:34 | FromDiscord | <.kanaxa> We really need a cookbook of sorts |
06:58:15 | FromDiscord | <.kanaxa> If I have time later this year I might get around doing it - could be a boon as well, since I'm an outsider coming in, so I have an outsider's perspective of the difficult of Nim for a beginner |
06:58:46 | FromDiscord | <.kanaxa> (edit) "difficult" => "difficulty" |
06:58:59 | FromDiscord | <user2m> In reply to @_gumbercules "it looks like it": yup that was it! I had to add the bin to PATH then restart |
06:59:10 | FromDiscord | <_gumbercules> \o/ |
07:00:38 | FromDiscord | <lfanew> In reply to @.kanaxa "As a beginner like": A bit rough on timing here too as Nim has grown a bit. I think Araq said he'll start working on a 2nd edition of his book if not started already which will have 2.0 as the base version at least |
07:00:51 | FromDiscord | <lfanew> (edit) "grown" => "changed" | "bit." => "bit past month or so ." |
07:02:25 | FromDiscord | <.kanaxa> In reply to @Elegantbeef "`io` is no longer": Wow, the std filesystem-ops modules have really been revised https://media.discordapp.net/attachments/371759389889003532/1137279421351477288/image.png |
07:13:15 | * | cestmoi joined #nim |
07:14:31 | FromDiscord | <Phil> In reply to @.kanaxa "We really need a": TBH in lieu of the time/motivation to write an entire one of those I've gone to the far easier variant and write self-answered Stack Overflow Questions |
07:15:57 | FromDiscord | <.kanaxa> Without a cookbook though, institutional and valuable Nim knowledge gets buried, especially for the day-to-day things |
07:16:32 | * | rockcavera quit (Remote host closed the connection) |
07:18:51 | FromDiscord | <Phil> I believe in the power of googling Stack Overflow more than a cookbook.↵Like I don't disagree with you, I'm more telling the story from my perspective and the solutions that I see with the resources I have available |
07:19:40 | FromDiscord | <Phil> (edit) "cookbook.↵Like" => "cookbook (in terms of what time and brainspace I can invest).↵Like" |
07:22:26 | FromDiscord | <Elegantbeef> Maybe one day I'll start to formalise the stuffs I know |
07:26:12 | FromDiscord | <.matrixagent> whats the recommended nim gui lib |
07:28:34 | FromDiscord | <.kanaxa> In reply to @isofruit "I believe in the": Fair point |
07:29:44 | FromDiscord | <Phil> In reply to @.kanaxa "Fair point": Case in point, I'm writing an SO quesiton about what I just learned from beef with echo someNimNode.treeRepr↵I could write a cookbook, but that would take more time than I have available, particularly since this is more a side-product of my research into how to do nim metaprogramming |
07:30:57 | FromDiscord | <.kanaxa> Y'all heard about the SO usage dropping thingy? |
07:31:10 | FromDiscord | <Phil> Yep |
07:31:10 | FromDiscord | <.kanaxa> Something about its traffic or user numbers going down |
07:31:26 | FromDiscord | <.kanaxa> That makes me wonder a bit |
07:31:34 | FromDiscord | <.kanaxa> How it'd got to that level, and whether it's a sustainable thing in the long run |
07:31:44 | FromDiscord | <Phil> Me too, however I still regard it as a resource of most importantly accurate information |
07:32:05 | FromDiscord | <Phil> (edit) "information" => "information, that's why I'd still use it rather than e.g. writing a blog-post or sth" |
07:32:44 | FromDiscord | <Phil> In reply to @.kanaxa "How it'd got to": AI is eating away at the simpler "How do I solve this minor syntax-problem" userbase I'd say |
07:33:15 | FromDiscord | <.matrixagent> In reply to @.kanaxa "Y'all heard about the": if their community wasnt so bad |
07:33:21 | FromDiscord | <.matrixagent> maybe it wouldnt have droppeds |
07:33:23 | FromDiscord | <.matrixagent> (edit) "droppeds" => "dropped" |
07:36:44 | FromDiscord | <.kanaxa> This is going to sound crazy: but where is the stdlib module for `readfile()`? I can't find it - since `io` is already deprecated |
07:37:01 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/syncio.html#readFile%2Cstring |
07:44:35 | FromDiscord | <Phil> Self answered question incoming |
07:45:16 | NimEventer | New question by Philipp Doerner: How can I see the contents of a NimNode?, see https://stackoverflow.com/questions/76840619/how-can-i-see-the-contents-of-a-nimnode |
07:48:51 | FromDiscord | <Phil> Out of curiosity, is there anyone out there that actually uses lisprepr? |
07:49:33 | FromDiscord | <Phil> I entirely acknowledge that I'm ignorant on the entire lisp-side of programming |
07:52:47 | FromDiscord | <jaar23> i wonder does nim has `byte` type like `[u8]`, `u8[]` ? |
07:53:28 | FromDiscord | <Elegantbeef> If you want to elaborate what those do perhaps |
07:58:46 | FromDiscord | <jaar23> sent a code paste, see https://play.nim-lang.org/#ix=4Cqb |
07:59:10 | FromDiscord | <jaar23> wondering if that is a different representation in nim? |
07:59:29 | FromDiscord | <Elegantbeef> `@myStr.toOpenArrayByte(0, myStr.high)` |
08:01:30 | * | ajunior quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…) |
08:02:08 | FromDiscord | <jaar23> why can i find more about `toOpenArrayByte()` proc? |
08:02:23 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/theindex.html#toOpenArray |
08:02:55 | FromDiscord | <bulan2> dkl ccb p |
08:06:08 | FromDiscord | <jaar23> how about converting `openArray[byte]` to string? ↵simply `$openArrayByte` ? |
08:06:20 | FromDiscord | <Elegantbeef> Nope |
08:06:26 | FromDiscord | <Elegantbeef> `$` would just stringify it |
08:06:45 | FromDiscord | <Elegantbeef> Which means `[0, 2, 3, ...]` or whatever |
08:07:19 | FromDiscord | <Elegantbeef> There is not a easy way to convert back afaik |
08:09:40 | FromDiscord | <jaar23> i see, not a easy way. i assume there is, right? 😆 |
08:10:23 | FromDiscord | <jaar23> i'm going to read the byte array from network and reading it in string (if parseable) then write it back to the network again. |
08:11:19 | FromDiscord | <Elegantbeef> Why not just read it as a string? |
08:11:26 | FromDiscord | <Phil> As somebody that basically never deals with bytes:↵convert to chat and collect those into a seq[char] and convert that to string? |
08:11:34 | FromDiscord | <Phil> (edit) "As somebody that basically never deals with bytes:↵convert ... toa" added "each byte" | "chat" => "a char" |
08:11:41 | FromDiscord | <Elegantbeef> Nim strings unlike Rust strings are not unicode, and are not immutable |
08:11:45 | FromDiscord | <Elegantbeef> Bleh phil |
08:11:55 | FromDiscord | <Phil> Nobody said it had to be fast! |
08:12:41 | FromDiscord | <Phil> Wait that would assume that it's ASCII encoded errrrrr |
08:12:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/rmtvE |
08:12:59 | FromDiscord | <Phil> Oh... wait how is that not an easy way beef? |
08:13:13 | FromDiscord | <Elegantbeef> No it doesnt |
08:13:14 | FromDiscord | <Elegantbeef> It's not in the stdlib, doesnt work on js or nimscript |
08:13:27 | FromDiscord | <Phil> In reply to @Elegantbeef "No it doesnt": I meant my approach would assume that |
08:13:34 | FromDiscord | <Elegantbeef> No it doesnt |
08:13:50 | FromDiscord | <Elegantbeef> Your operation is not encoding aware |
08:14:03 | FromDiscord | <Phil> Actually, fair |
08:14:04 | FromDiscord | <Elegantbeef> It works on utf8 utf16 utf32 ascii |
08:14:22 | FromDiscord | <jaar23> In reply to @Elegantbeef "Why not just read": can we? |
08:14:36 | FromDiscord | <Elegantbeef> It's just data `0..255` Byte is the same as `\0..\255` |
08:14:39 | FromDiscord | <Elegantbeef> Yes you can read strings |
08:14:42 | FromDiscord | <Phil> God I deal with this kind of stuff so rarely I read up on it like once a year when I need it and forget immediately after |
08:14:44 | FromDiscord | <Elegantbeef> Nim's api's generally prefer strings |
08:15:44 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/net.html#recv%2CSocket%2Cstring%2Cint%2Cint jaar |
08:17:08 | FromDiscord | <jaar23> oh wait, in nim we can directly read that network data into string? |
08:17:24 | FromDiscord | <Elegantbeef> Wild I know |
08:17:25 | FromDiscord | <Elegantbeef> There is even a low level `read` that takes a `pointer` |
08:17:33 | FromDiscord | <Elegantbeef> So you could write to anything you really wanted |
08:18:13 | FromDiscord | <Elegantbeef> This is the perks of not using string builders or utf8 aware strings |
08:18:16 | FromDiscord | <Elegantbeef> It's cheap to do all of this fun stuff |
08:18:30 | FromDiscord | <Elegantbeef> And with that I go |
08:19:11 | FromDiscord | <jaar23> okay, that really surprise me. As a user coming from java and rust, i always have to do the conversion after reading from network. |
08:19:24 | FromDiscord | <jaar23> i assume that is the default 😆 |
08:20:19 | * | lfanew left #nim (#nim) |
08:20:20 | FromDiscord | <Phil> I just imagine beef following the classic "my job here is done" meme |
08:20:34 | FromDiscord | <Phil> (edit) "I just imagine beef following the classic "my job here is done" meme ... " added "and willowing his cape" |
08:21:01 | FromDiscord | <jaar23> i can imagine that. |
08:21:05 | FromDiscord | <Phil> (edit) "willowing" => "billowing" |
08:33:50 | FromDiscord | <.kanaxa> In reply to @Elegantbeef "`$` would just stringify": When I first came to Nim I found it insanely cool that the string-casting operator was the `$` sign - and string concatenation was `&` instead of `+` (which threw me off a bit) |
08:34:15 | FromDiscord | <.kanaxa> Instead of having to `str()` or `.toStr()` something |
08:34:26 | FromDiscord | <.kanaxa> And then I discovered Nim's operator overloading and I was like blown away |
08:34:44 | FromDiscord | <.kanaxa> And I was completely misled by ChatGPT when I asked it questions on those things, because it was hallucinating between languages haha |
08:36:04 | FromDiscord | <.kanaxa> Another thing that threw me off was `[]` vs `@[]` - because there's no fixed-sized lists in Python, and I was like... wait, what, why do you need an array and a sequence, when in Python a list is a sequence |
08:36:12 | FromDiscord | <.kanaxa> That cognitive dissonance |
08:39:03 | FromDiscord | <Phil> Okay I have arrived at the point where I'm realizing that a ton of the compiletime stuff I have done so far was way more complicated than literally just using macros |
08:39:14 | FromDiscord | <Phil> Like holy shit did I stretch the concept of generics and templates to its absolute limits |
08:39:28 | FromDiscord | <jensl> hey, does anyone here use a nim lsp in nvim? |
08:39:53 | FromDiscord | <Phil> There are a couple folks here but I keep forgetting who all does. I think PMunch is one of the guys that does |
08:40:14 | FromDiscord | <jensl> imma have to know how he did it |
08:40:25 | FromDiscord | <Phil> (That name mention should be enough to ping him given he uses matrix, we'll have to wait for him to come online or somebody else to step up) |
08:40:53 | FromDiscord | <jensl> bc mine says it's on but it's not completing sht |
08:41:46 | FromDiscord | <jensl> but maybe I'm dumb bc nvim doesn't even highlight my nim syntax |
08:42:19 | FromDiscord | <Phil> Hmmm PMunch stated he was pretty happy with nim highlighting etc. if I recall correctly, so definitely fixable |
08:44:43 | FromDiscord | <Phil> Hmmm how do I get all fields an object-type has if all I have is the NimNode `ident("MyType")` ? |
08:45:04 | FromDiscord | <Phil> (edit) "Hmmm how do I get all fields an object-type ... has`ident("MyObjectType")`" added "`MyObjectType`" | "`ident("MyType")`" => "`ident("MyObjectType")`" |
08:48:07 | FromDiscord | <Phil> Wait, maybe getImpl |
08:58:14 | FromDiscord | <jaar23> In reply to @.kanaxa "And I was completely": chatgpt cannot understand nim correctly. lol |
08:59:25 | FromDiscord | <Phil> In reply to @.kanaxa "And then I discovered": Keep in mind that particularly operator overloading can be an amazingly effective footgun |
09:00:41 | FromDiscord | <jaar23> In reply to @jensl "hey, does anyone here": i have been struggling abit over this too. ↵i tried multiple neovim distro, lazy, nvim-chad, doom, etc, none of them successfully setup with nim. |
09:00:46 | FromDiscord | <Phil> In reply to @.kanaxa "Another thing that threw": And yeah, fixed-length array (on the stack) vs mutable-length seq (on the heap) can be a bit of a thing to wrap your head around.↵Though I started in java so I guess I had a bit of a head start on that one |
09:01:21 | FromDiscord | <jaar23> until i found oh-my-nvim, and setup according to this, https://github.com/alaviss/nim.nvim and https://github.com/hardhackerlabs/oh-my-nvim |
09:01:41 | FromDiscord | <jaar23> then it is finally working on my nvim :nim4: |
09:04:40 | FromDiscord | <jaar23> not to mention, raw neovim with that setup would works too. |
09:18:36 | NimEventer | New thread by Odysseus: A few (perhaps naive) questions, see https://forum.nim-lang.org/t/10377 |
09:30:36 | FromDiscord | <Phil> Okay so I feel like `getImpl` is the way to get the definition of a type from its string representation.↵I just don't get how |
09:31:17 | FromDiscord | <Phil> Like, I have the NimNode of this proc definition:↵` proc myMapProc(source: A, target: B): string =`↵How do I figure out which fields B has ? |
09:31:56 | FromDiscord | <Phil> (edit) "Like, I have the NimNode of this proc definition:↵` proc myMapProc(source: A, target: B): string =`↵How do I figure out which fields B has ?" => "sent a long message, see http://ix.io/4CqS" |
09:33:43 | FromDiscord | <.kanaxa> In reply to @isofruit "Keep in mind that": Indeed - though a footgun is still a nice thing to have, used responsibly |
09:33:46 | * | qwestion quit (Ping timeout: 245 seconds) |
09:33:56 | FromDiscord | <.kanaxa> I just built my first Nimscript file to replace an earlier Bash script for running tmux |
09:34:01 | FromDiscord | <.kanaxa> OMG THIS IS AMAZINGBALLS |
09:34:16 | FromDiscord | <Phil> That was how I felt with replacing like a dozen of them with nimble tasks |
09:34:23 | FromDiscord | <.kanaxa> I could have done this in Python but it's so much clearer in Nim since I don't have to reference any modules |
09:34:31 | FromDiscord | <.kanaxa> And everything's just `exec` |
09:34:40 | FromDiscord | <.kanaxa> And my functions actually make sense now compared to Bash |
09:50:39 | FromDiscord | <.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Cr1 |
09:52:39 | FromDiscord | <.kanaxa> Is there an idiomatic way to do this in Nim? |
09:54:25 | FromDiscord | <Phil> I haven't checked gorgeEx, but are you sure the exit code isn't simply accessible as part of whatever exception gorgeEx throws if it fails? |
09:56:47 | FromDiscord | <Phil> In reply to @.kanaxa "Okay I'm in a": I don't think you'll get an exception, I think your exit code will simply be of a value that represents "an error ocurred" |
09:57:19 | FromDiscord | <Phil> I'd need to check what the exit_code conventions were to tell you which value represents a success and which represent common failure types |
09:57:26 | FromDiscord | <Phil> (edit) "I'd need to check what the exit_code conventions ... were" added "in bash" |
09:57:31 | FromDiscord | <.kanaxa> Hmm, you have a point on the exit code |
09:57:56 | FromDiscord | <.kanaxa> Still, assuming that an exception was raised, how to do I get the exception message? |
09:58:07 | NimEventer | New question by Philipp Doerner: How to get all fields of an object type `MyType` in a macro from a NimNode ident("MyType"), see https://stackoverflow.com/questions/76841073/how-to-get-all-fields-of-an-object-type-mytype-in-a-macro-from-a-nimnode-ident |
09:58:14 | FromDiscord | <.kanaxa> I tried ` echo "Didn't run: ", getCurrentException() ` but it didn't work |
09:58:30 | FromDiscord | <.kanaxa> (edit) "I tried ` echo "Didn't run: ", getCurrentException() ` ... but" added "in the `except` clause," |
10:00:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Crb |
10:00:45 | FromDiscord | <Phil> blank except is discouraged generally |
10:01:02 | FromDiscord | <Phil> And also "didn't work" doesn't tell me how it didn't work 😛 |
10:01:19 | FromDiscord | <Phil> As I still don't know if gorgeEx actually throws exceptions |
10:01:22 | FromDiscord | <.kanaxa> In reply to @isofruit "blank except is discouraged": True, but I'm accessing the https://nim-lang.org/docs/tut2.html↵↵It says here: _"...If you need to access the actual exception object or message inside an except branch you can use the getCurrentException() and getCurrentExceptionMsg() procs from the system module. Example:"_ |
10:01:29 | FromDiscord | <.kanaxa> So I'm wondering how I can get to that exception message |
10:02:18 | FromDiscord | <.kanaxa> I've been testing out something like `discard 1/0` which should raise a DividebyZero error of sorts |
10:02:27 | FromDiscord | <.kanaxa> But it doesn't raise anything, and I can't get to the exception |
10:03:00 | FromDiscord | <.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Crd |
10:03:41 | FromDiscord | <Phil> ?↵Okay, give me your current nim version and how you compile that |
10:03:45 | FromDiscord | <Phil> Because that runs for me |
10:03:58 | FromDiscord | <.kanaxa> I'm on Nim 2.0.0 |
10:04:18 | FromDiscord | <Phil> hmmm |
10:04:27 | FromDiscord | <Phil> For reference:↵https://play.nim-lang.org/#ix=4Cre↵↵Works on play nim lang |
10:05:26 | FromDiscord | <.kanaxa> Yeah it's really weird, when I removed all reference to `getCurrentExceptionMsg()`, the code works |
10:05:30 | FromDiscord | <Phil> Lul, no 1/0 does not raise an exception |
10:05:31 | FromDiscord | <.kanaxa> So I'm not sure why |
10:06:01 | FromDiscord | <.kanaxa> In reply to @isofruit "Lul, no 1/0 does": There's no `ZeroDivisionError` exception in Nim? |
10:06:02 | FromDiscord | <Phil> 1/0 is a float with a value of "inf" |
10:06:02 | FromDiscord | <.kanaxa> Dang |
10:07:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Crf |
10:08:03 | FromDiscord | <.kanaxa> Running that exactly https://media.discordapp.net/attachments/371759389889003532/1137326143394029568/image.png |
10:08:12 | FromDiscord | <.kanaxa> But still getting this: _"...Error: undeclared identifier: 'getCurrentExceptionMsg' candidates (edit distance, scope distance); see '--spellSuggest': (3, 4): 'getCurrentException'"_ |
10:08:13 | FromDiscord | <.kanaxa> Hmmmm |
10:08:24 | FromDiscord | <Phil> Ignore nimsuggest for a second, is that your terminal output after compiling? |
10:08:30 | FromDiscord | <.kanaxa> yeah |
10:08:45 | FromDiscord | <Phil> What is the entire code you're running? |
10:08:48 | FromDiscord | <.kanaxa> Is there some module I'm not importing for the identifier |
10:09:08 | FromDiscord | <Phil> I compiled my example without any imports whatsoever so that yours doesn't work is weird as heck |
10:09:18 | FromDiscord | <.kanaxa> In reply to @isofruit "What is the entire": OH WAIT |
10:09:19 | FromDiscord | <.kanaxa> What the hell |
10:09:25 | FromDiscord | <.kanaxa> I ran that in a Nimscript file |
10:09:27 | FromDiscord | <.kanaxa> No wonder |
10:09:32 | FromDiscord | <.kanaxa> The identifier's valid in a full Nim script |
10:09:40 | FromDiscord | <.kanaxa> Dammit |
10:09:41 | FromDiscord | <Phil> Well that clears that up 😄 |
10:09:49 | FromDiscord | <.kanaxa> Argh, this is the confusion I got into just now |
10:09:49 | FromDiscord | <.kanaxa> Hahahaha |
10:09:56 | FromDiscord | <.kanaxa> Thanks for the pointers! |
10:10:16 | FromDiscord | <Phil> Sidenote, stuff like this is why I basically have all my nimscript code squeezed into my nimble file |
10:10:26 | FromDiscord | <Phil> No chance of mixing things up |
10:10:33 | FromDiscord | <.kanaxa> Mmmm, good point |
10:10:39 | FromDiscord | <Phil> And even with like a dozen tasks that thing is still less than 200 loc |
10:10:47 | FromDiscord | <.kanaxa> I'm actually trying to use Nimscript for automation and as a Bash replacement for now, not doing any packaging just yet with Nimble |
10:10:55 | FromDiscord | <Phil> Ahh check |
10:11:23 | FromDiscord | <.kanaxa> That being said though, on the earlier example |
10:14:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cri |
10:15:07 | NimEventer | New thread by mohan24: Why this nim code is not valid?, see https://forum.nim-lang.org/t/10378 |
10:15:42 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Cri" => "https://paste.rs/IAB2B" |
10:22:03 | * | disso-peach joined #nim |
10:28:38 | FromDiscord | <Phil> Heya enthus1ast, if you're there, could you check out my macro question here: https://stackoverflow.com/questions/76841073/how-to-get-all-fields-of-an-object-type-mytype-in-a-macro-from-a-nimnode-ident ?↵↵Trying to wrap my head around how to solve this and I'm not finding anything obvious in std/macros, thought maybe you stumbled over something for this |
10:29:01 | FromDiscord | <Phil> (edit) "stumbled over something for this" => "are familiar with an obvious solution" |
10:29:16 | FromDiscord | <.kanaxa> In reply to @isofruit "Heya enthus1ast, if you're": I wish I could help, but this is so far beyond me at this level |
10:30:00 | FromDiscord | <Phil> I mean, it took me ~18 months in nim to get comfortable enough in the language to properly approach macros |
10:30:04 | FromDiscord | <Phil> So no worries, I won't judge ^^ |
10:33:02 | FromDiscord | <jensl> In reply to @jaar23 "i have been struggling": im using lazyvim and just tried installing both `nimlsp` and `nimlangserver` using Mason |
10:33:14 | FromDiscord | <jensl> but simple doing that apparently isn't enough |
10:34:21 | FromDiscord | <jaar23> In reply to @jensl "im using lazyvim and": Yes, I tried both too. But keep having error whenever loading Nim file. After I switch to oh-my-nvim then it works. |
10:34:54 | FromDiscord | <jaar23> I think there may be conflict or need extra setup on lazyvim |
10:35:47 | FromDiscord | <jensl> that's what I was thinking, but given they include it in the list of LSPs for you that seems silly |
10:36:44 | FromDiscord | <jensl> In reply to @jaar23 "I think there may": did you get syntax highlighting on lazyvim? |
10:39:24 | FromDiscord | <jaar23> In reply to @jensl "did you get syntax": Not always. On first load, the syntax is working. After some editing, the syntax highlight go haywire. |
10:39:46 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137334123657179156/image.png |
10:39:49 | FromDiscord | <jensl> it gives me lsp info |
10:39:50 | FromDiscord | <jaar23> I guess there is no treesitter for nim too |
10:40:01 | FromDiscord | <jensl> but I get zero highlights lmao |
10:40:42 | FromDiscord | <jaar23> Have you change your theme with treesitter support? I'm using sonokai and it has the highlight |
10:40:51 | FromDiscord | <jensl> maybe it's the theme |
10:40:55 | FromDiscord | <jensl> im using kanagawa |
10:44:06 | FromDiscord | <shalokshalom> In reply to @jaar23 "I guess there is": One at least started an implementation |
10:44:28 | FromDiscord | <shalokshalom> I know about about the generation to treesitter files from other formats |
10:44:51 | FromDiscord | <shalokshalom> The indendation based stuff is usually not possible to port that way, so it's a petty for Nim |
10:51:01 | FromDiscord | <jensl> I changed the theme to gruvbox |
10:51:04 | FromDiscord | <jensl> didn't help |
10:51:05 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137336972210339932/image.png |
10:51:15 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137337012811206687/image.png |
11:07:50 | FromDiscord | <jaar23> In reply to @jensl "I changed the theme": I'm struggling for quite some times too. Until I changed the nvim distro. ↵Or you can try helix. |
11:13:16 | FromDiscord | <jensl> I love my lazyvim so I'll do my best |
11:13:39 | FromDiscord | <jensl> do I need to manually install `nimsuggest` using nimble? |
11:16:41 | FromDiscord | <Phil> nimsuggest is part of the compiler IIRC so it shouldn't be necessary, at most the language server might need an install |
11:16:46 | NimEventer | New thread by Isofruit: How to get all fields of an object type `MyType` in a macro from a NimNode ident("MyType"), see https://forum.nim-lang.org/t/10379 |
11:17:11 | FromDiscord | <jensl> In reply to @isofruit "nimsuggest is part of": that's what I thought |
11:17:16 | FromDiscord | <jensl> I have done `nimble install nimlsp` |
11:18:40 | Amun-Ra | right, nimble search nimsuggest returns two options |
11:22:48 | NimEventer | New thread by IvanS: Autome import throws error, see https://forum.nim-lang.org/t/10381 |
12:38:12 | * | jmdaemon quit (Ping timeout: 240 seconds) |
12:51:54 | * | cestmoi quit (Ping timeout: 252 seconds) |
13:59:46 | * | psydruid quit (Write error: Connection reset by peer) |
14:01:51 | FromDiscord | <Phil> Okay I think I finally had my "it clicks" moment with macros, hot damn |
14:01:59 | FromDiscord | <Phil> Only took forever |
14:02:51 | * | rockcavera joined #nim |
14:35:32 | * | xet7 joined #nim |
14:58:41 | NimEventer | New post on r/nim by NotMattA: Just got into Nim and played around with the macro system to copy over a feature I enjoyed in Zig: labelled/named loops, see https://reddit.com/r/nim/comments/15ixtkv/just_got_into_nim_and_played_around_with_the/ |
14:59:03 | FromDiscord | <x.hat> Just got into Nim this weekend- I just played around with the macro system to copy over a feature I enjoyed in Zig called labelled/named loops: https://gist.github.com/MattAlp/ca24060733e1142ac4823179d69cedf9 |
14:59:18 | FromDiscord | <x.hat> Oh, looks like the bot beat me to it haha |
14:59:29 | FromDiscord | <x.hat> Really enjoying the language so far! |
15:20:48 | * | ajunior joined #nim |
15:30:33 | * | azimut joined #nim |
15:31:11 | * | junaid_ joined #nim |
16:04:09 | FromDiscord | <tapeda> sent a code paste, see https://play.nim-lang.org/#ix=4Cta |
16:05:58 | FromDiscord | <Phil> Generally that's also the best idea to go about it:↵Use macros basically only as a last resort when all else fails you. |
16:07:58 | * | azimut quit (Ping timeout: 240 seconds) |
16:16:21 | FromDiscord | <shalokshalom> what was the code generation method, that is supposed to be used before one thinks about templates, again? |
16:16:52 | FromDiscord | <shalokshalom> I think it was like x -> Templates -> Macros |
16:19:37 | FromDiscord | <.kanaxa> In reply to @isofruit "Okay I think I": I love the clicky moments man, it's that feeling of epiphany |
16:21:16 | ehmry | is there a rule on when to use std/macros and when to use compiler/* modules? |
16:21:23 | FromDiscord | <demotomohiro> In reply to @x.hat "Just got into Nim": I also wrote namedWhile macro before.↵https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/namedWhile.nim |
16:21:45 | ehmry | I have code that uses the compiler package and I forget exactly why I was using it |
16:25:19 | FromDiscord | <demotomohiro> You use std/macros when you write macros.↵Which module in compiler/ do you use? |
16:28:35 | ehmry | demotomohiro: ast, idents, renderer, lineinfos |
16:29:40 | ehmry | with 2.0.0 I get partial code rendering so I think I should go back to std/macros |
16:29:59 | ehmry | I'm not macro'ing, I'm generating code from scratch |
16:31:05 | FromDiscord | <demotomohiro> I guess you tried to get lower level AST info that macro module cannot? |
16:31:17 | ehmry | must have been |
16:31:55 | ehmry | if I need something from compiler in macros is it reasonable to port it over and make a PR? |
16:31:58 | * | ajunior quit (Ping timeout: 246 seconds) |
16:36:14 | FromDiscord | <requiresupport> any idea why cross compilation from linux to windows gives following error? `fatal error: windows.h: No such file or directory` |
16:36:19 | FromDiscord | <requiresupport> used to work find before update |
16:36:32 | * | ajunior joined #nim |
16:36:43 | FromDiscord | <.kanaxa> sent a long message, see http://ix.io/4Cto |
16:36:56 | FromDiscord | <.kanaxa> (edit) "http://ix.io/4Cto" => "http://ix.io/4Ctp" |
16:38:48 | Amun-Ra | no -d=mingw? |
16:39:31 | FromDiscord | <demotomohiro> I think gcc contains windows.h on windows. |
16:39:32 | FromDiscord | <requiresupport> added, the problem was I was using `--os:windows` 😓 |
16:39:56 | Amun-Ra | :> |
16:40:01 | FromDiscord | <demotomohiro> Or you are not using gcc for windows? |
16:40:17 | FromDiscord | <requiresupport> was using mingw on linux to compile for windows |
16:40:47 | * | tiorock joined #nim |
16:40:47 | * | tiorock quit (Changing host) |
16:40:47 | * | tiorock joined #nim |
16:40:47 | * | rockcavera is now known as Guest5764 |
16:40:47 | * | Guest5764 quit (Killed (osmium.libera.chat (Nickname regained by services))) |
16:40:47 | * | tiorock is now known as rockcavera |
16:41:33 | Amun-Ra | the only required define for this is mingw, and optional --cpu=i386/amd64 |
16:43:37 | FromDiscord | <demotomohiro> In reply to @.kanaxa "I'm looking at the": `->` is a macro allows you to write a procedural type easier.↵It seems `noSideEffect` pragma is only applied to that procedural type. |
16:46:19 | FromDiscord | <jaar23> sent a code paste, see https://play.nim-lang.org/#ix=4Ctw |
16:46:44 | FromDiscord | <demotomohiro> In reply to @requiresupport "any idea why cross": Are you sure your Nim calls right gcc for cross compiling?↵Adding `--listcmd` compiler option to Nim shows command lines to call backend C compiler. |
16:47:22 | FromDiscord | <nasuray> In reply to @jensl "I love my lazyvim": my current setup uses `lazyvim` and `nimlsp` will occasionally fail but has been much more stable on 2.0. For syntax highlighting I use https://github.com/alaviss/nim.nvim |
16:47:25 | FromDiscord | <jaar23> In reply to @jaar23 "i think i'm not": if i uncomment the `sleep(1)` line and it working fines. i do not understand why . |
16:48:03 | FromDiscord | <requiresupport> In reply to @demotomohiro "Are you sure your": I fixed the problem, the problem was adding these params to compile `--os:windows` |
16:50:28 | Amun-Ra | iirc it works with or without --os=windows on debian |
16:50:39 | * | ajunior quit (Ping timeout: 246 seconds) |
16:52:55 | * | ajunior joined #nim |
16:56:41 | FromDiscord | <Phil> sent a long message, see http://ix.io/4CtC |
16:57:08 | FromDiscord | <Phil> (edit) "http://ix.io/4CtC" => "http://ix.io/4CtD" |
16:57:35 | * | ajunior quit (Ping timeout: 245 seconds) |
17:03:13 | FromDiscord | <demotomohiro> In reply to @isofruit "God dangit. Had a": You probably need to copy NimNode tree and modify it instead of directly modifying NimNode from parameter. |
17:04:51 | * | ajunior joined #nim |
17:06:38 | FromDiscord | <Phil> In reply to @demotomohiro "You probably need to": Holy expletives that worked! |
17:07:30 | FromDiscord | <Phil> Okay I'm starting to actually like macros now, getting this endorphine rush of "Everything works now" |
17:08:31 | Amun-Ra | I remember when my first macro worked… |
17:09:59 | FromDiscord | <bostonboston> `macro imarealprogrammer() = discard` |
17:10:57 | * | ajunior quit (Ping timeout: 246 seconds) |
17:11:50 | FromDiscord | <.kanaxa> In reply to @demotomohiro "`->` is a macro": I'm sorry, but I don't quite get your second sentence |
17:12:40 | FromDiscord | <.kanaxa> What is a 'procedural type'? I only know of the procedural programming paradigm |
17:13:26 | FromDiscord | <Phil> In reply to @.kanaxa "What is a 'procedural": He's speaking from a macro perspective |
17:13:30 | FromDiscord | <Phil> There language constructs have types |
17:13:58 | FromDiscord | <Phil> Actually no, never mind, he just means that the proc definition is a type itself, so you can more easily write proc definitions |
17:14:25 | FromDiscord | <Phil> Like this :↵`proc(bla: string)` ↵is a type |
17:16:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CtI |
17:16:25 | FromDiscord | <Phil> `proc(bla: string)` is a procedural type in this scenario because it is the type of a proc |
17:16:36 | FromDiscord | <.kanaxa> In reply to @.kanaxa "I'm looking at the": What about the `{.noSideEffects}` part? Why is it set to the parameter, rather than the function? |
17:16:54 | FromDiscord | <Phil> In reply to @.kanaxa "What about the `{.noSideEffects}`": How familiar are you with functional programming? |
17:16:55 | Amun-Ra | func(x:string):bool is a functional type |
17:17:11 | FromDiscord | <.kanaxa> In reply to @isofruit "How familiar are you": I've done it before, but I can't say I'm too familiar with it |
17:17:20 | FromDiscord | <.kanaxa> I'm aware of the concept of side effects |
17:17:30 | FromDiscord | <.kanaxa> I'm more curious about the pragma syntax for that in Nim |
17:17:34 | FromDiscord | <Phil> In reply to @.kanaxa "I've done it before,": It's more of the concept of side-effects:↵Does a proc do more than just map input to output? If so, it has side-effects |
17:17:47 | FromDiscord | <Phil> Reading from disk: A side effect↵echoing: A side effect↵etc. |
17:18:11 | FromDiscord | <.kanaxa> If a function is not to have side effects, why do we declare the {.noSideEffect} pragma to the parameter, rather than to the function? At least, per the `sugar` module's syntax |
17:18:48 | FromDiscord | <.kanaxa> The example code does run, I'm just having trouble wrapping my head around the syntax |
17:19:06 | FromDiscord | <Phil> With the pragma you basically guarantee that the only thing that the type ↵`(int {.noSideEffect.} -> int)` does (which maps an int to another int) is the mapping. ↵The compiler will break you if you try to put a proc in there that does mapping and also e.g. echoes |
17:20:07 | FromDiscord | <Phil> You were already familiar with it I now realizes after rereading, moving on:↵`->` is not real |
17:20:39 | FromDiscord | <Phil> In fact it is, as stated, a macro to turn `int -> int` into `proc(x: int): int` (x is irrelevant, can be whatever) |
17:20:59 | FromDiscord | <Phil> And it seems here that due to the way the macro transforms the expression the pragma goes directly after the parameter |
17:21:06 | FromDiscord | <.kanaxa> I've seen the arrow function like this in JS before, I've just never encountered a pragma like this at the parameter |
17:21:11 | FromDiscord | <.kanaxa> Which is why I'm so confused |
17:21:44 | FromDiscord | <.kanaxa> sent a long message, see http://ix.io/4CtM |
17:22:31 | FromDiscord | <Phil> It's less that it's applied to the parameters and more the way `->` transforms the expression into a `proc(x, y: int): int {.noSideEffect.}` expression |
17:22:43 | FromDiscord | <.kanaxa> Ahh |
17:24:00 | FromDiscord | <.kanaxa> In reply to @isofruit "It's less that it's": Oddly enough I tried that other syntax - `proc passTwo(f: ((int, int) -> int)): int {.noSideEffect.} = ...` - it's not valid syntax |
17:24:09 | FromDiscord | <Phil> One sec |
17:24:14 | * | ajunior joined #nim |
17:24:17 | FromDiscord | <.kanaxa> Macro-generated syntax really works my brain |
17:29:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CtS |
17:30:01 | FromDiscord | <Phil> It's just about how `->` shuffles the pieces of code around |
17:30:33 | * | ajunior quit (Ping timeout: 246 seconds) |
17:30:33 | FromDiscord | <.kanaxa> Oh man! Thank you |
17:30:35 | FromDiscord | <.kanaxa> gotta study this |
17:30:49 | FromDiscord | <Phil> Honestly you shouldn't ever need to use the noSideEffect pragma |
17:31:02 | FromDiscord | <Phil> because you can just use `func` which is more expressive |
17:31:15 | FromDiscord | <Phil> a proc is a procedure and is allowed to have side-effect.↵A func isn't |
17:31:23 | FromDiscord | <Phil> (edit) "isn't" => "isn't, it is a function to map input to output" |
17:31:53 | FromDiscord | <.kanaxa> In reply to @isofruit "Honestly you shouldn't ever": I was aware of `func` but I didn't know the `noSideEffect` pragma wasn't meant for general use, rawghhh |
17:32:54 | FromDiscord | <Phil> In reply to @.kanaxa "I was aware of": I mean it makes sense in this context because the person wanted to write a proc-type in the style of a JS callback function but at the same time have no side effects.↵And then just didn't take into consideration that they might as well just write out "func" |
17:33:04 | FromDiscord | <Phil> (edit) ""func"" => "the proc definition the normal way using func" |
17:34:04 | FromDiscord | <Phil> Regarding pragmas, generally their useage while you code at a high-ish level (so no dealing with memory and metaprogramming) should be close to zero, maybe if a library uses them and asks you to annotate some stuff here or there but that should be documented by the lib. |
17:34:34 | FromDiscord | <Phil> The lower and more in-depth you go the more common they can become, but generally they aren't necessary for the bulk of your code. |
17:34:35 | * | azimut joined #nim |
17:34:40 | FromDiscord | <.kanaxa> Mmmmmmh, I see |
17:34:59 | FromDiscord | <.kanaxa> I keep seeing them everywhere in Nim code, so I thought they were high-usage syntax |
17:35:09 | FromDiscord | <.kanaxa> (edit) "high-usage" => "high-usage/common" |
17:35:39 | FromDiscord | <Phil> They can be, but by no means are they required in general.↵Like you can do some nifty stuff with them, such as annotating a proc to tell procs that call it which exceptions this one might throw |
17:36:00 | FromDiscord | <Phil> Or you might tag it and other procs might say "no, you can not use procs tagged like that here", or they might say "only procs tagged like that can be used in here" |
17:36:34 | FromDiscord | <Phil> But that is the kind of setup you do for projects that are either↵a) large↵and/or b) complex↵and/or c) involve a team of users |
17:36:54 | * | ajunior joined #nim |
17:37:04 | FromDiscord | <Phil> (edit) "complex↵and/or" => "complex (either in metaprogramming or in performance optimization and thus in dealing with memory)↵and/or" |
17:37:13 | FromDiscord | <Phil> (edit) "users" => "devs" |
17:38:08 | FromDiscord | <.kanaxa> This is so helpful man, thank you so much! |
17:39:07 | FromDiscord | <.kanaxa> Conceptually I can usually get what's happening, but it's the syntax that gets me, and what's idiomatic/common/best practices |
17:41:33 | FromDiscord | <Phil> For reference, in a codebase with around 10.000 loc I use around 125 pragmas.↵Around 90 of those are because the libs constructor and norm require their use to inform them about default values, foreign-key relationships, tableNames that a given model is associated with etc.↵↵another 20 or so are just the async pragma that prologue requires |
17:41:40 | FromDiscord | <Phil> (edit) "requires" => "requires, so again not my choice" |
17:42:11 | FromDiscord | <Phil> Leaving me with around ~15 or so pragmas I actually added myself to opt into a feature. ↵Which was to force specific procs to only be available at compiletime so that I can't misuse them |
17:42:30 | FromDiscord | <.kanaxa> Mmmm, I see |
17:42:41 | FromDiscord | <Phil> But even that is optional |
17:42:48 | * | ajunior quit (Ping timeout: 246 seconds) |
17:43:06 | FromDiscord | <Phil> So I really wouldn't jump into pragmas at all unless you're forced into it.↵They're the kind of thing personally I look up when I think "Man, it would be nifty if I could have X" |
17:43:12 | * | ajunior joined #nim |
17:43:50 | FromDiscord | <.kanaxa> In reply to @isofruit "So I really wouldn't": So definitely something I should reserve for later once I get proper into metaprogramming |
17:43:54 | FromDiscord | <Phil> Like the entire effects system: I do not use it for I have no usecase for it.↵I likely could, but the benefits of using it would (for me) not outweigh the drawback of the work involved |
17:44:04 | FromDiscord | <.kanaxa> Because I'm coming into Nim with this strong impression that it's a language for metaprogrammers |
17:44:09 | FromDiscord | <.kanaxa> Hence why I thought I had to get into it straight |
17:44:13 | FromDiscord | <Phil> In reply to @.kanaxa "So definitely something I": Reserve it as the kind of thing you deal with when you want to use a lib and the lib asks you pretty much |
17:44:53 | FromDiscord | <Phil> Otherwise you'll have your hands full getting used to the language in general |
17:45:12 | FromDiscord | <.kanaxa> Just wondering, is everyone here on this group professional/fulltime programmers? I recall reading some guesstimation on the forum about there being only about 80k+ active Nim programmers or something (derived as a more realistic 5-10% of the total Nim download count) |
17:45:14 | FromDiscord | <Phil> In reply to @.kanaxa "Because I'm coming into": All of those are opt in features.↵I didn't touch templates until I was like 6 months in and thought "Man, I want context managers like in python for this thing" |
17:46:06 | FromDiscord | <Phil> No idea, I think Beef would disavow being called professional in any capacity despite being a near bottomless well of knowledge.↵A couple folks I know here are, not sure about the majority |
17:46:15 | FromDiscord | <.kanaxa> In reply to @isofruit "Otherwise you'll have your": Yeah, I was messing around with Nim's regular expression stuff today, and I kept getting whacked with the differences: "Wait, you declare the string first, and then the pattern expression after? Wait, you now have `find`/`replace`, not `search`/`sub`?" Stuff like that |
17:46:33 | FromDiscord | <requiresupport> how do i define something if code is built for `--app:lib` ? |
17:46:39 | FromDiscord | <.kanaxa> (edit) "`search`/`sub`?"" => "`search`/`sub`? Wait, search returns an `int`, and not the match object's string?"" |
17:47:22 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CtU |
17:47:57 | FromDiscord | <demotomohiro> In reply to @requiresupport "how do i define": Do you want to call Nim procedures from C code? |
17:49:05 | FromDiscord | <requiresupport> `when defined(...)` if code is built with params `--app:lib` |
17:49:22 | FromDiscord | <requiresupport> (edit) |
17:49:40 | * | ajunior quit (Ping timeout: 246 seconds) |
17:50:44 | FromDiscord | <.kanaxa> In reply to @isofruit "All of those are": I'm barely a month in, got a long way to go |
17:50:58 | FromDiscord | <.kanaxa> I'm also messing around with metaprogramming in Python, so I'm keen on studying the differences between the two |
17:51:02 | FromDiscord | <.kanaxa> (edit) "the two" => "that and in Nim" |
17:51:15 | FromDiscord | <requiresupport> In reply to @requiresupport "<@288750616510201856> `when defined(...)`": `when appType == "lib"` |
17:51:21 | FromDiscord | <Phil> You mean messing with dunder functions in python? |
17:51:50 | FromDiscord | <Phil> (edit) "python?" => "python like `str`?" |
17:54:01 | FromDiscord | <.kanaxa> In reply to @isofruit "You mean messing with": Like metaclasses - I've never had a real need for them in Python, just curiosity |
17:55:09 | FromDiscord | <Phil> In reply to @.kanaxa "Like metaclasses - I've": Oh lord I barely remember them from Django, they had that stuff somewhere... were they the equivalent of an abstract class in java?↵I have entirely forgotten since then |
17:56:45 | FromDiscord | <.kanaxa> Sort of yeah, the ABC stuff and the metaclass_ thingy, classes that create classes - that stuff got me curious and was one of the things that led to me discover Nim |
17:57:06 | * | ajunior joined #nim |
17:57:13 | FromDiscord | <.kanaxa> (edit) "metaclass_" => "\_\_metaclass\_\_" |
17:59:10 | Amun-Ra | Phil: it's a different kind of beast, metaclass is something that creates/modifies classes |
17:59:53 | FromDiscord | <Phil> I'm only aware of mixins in that regard but that was an architectural-thing, not a syntax thing |
18:00:16 | FromDiscord | <Phil> So what, they made an explicit language construct for the equivalent of the Factory Pattern? |
18:00:41 | FromDiscord | <Phil> (edit) "mixins" => "mixin classes" |
18:01:04 | FromDiscord | <.kanaxa> Sort of, yeah: https://stackoverflow.com/questions/100003/what-are-metaclasses-in-python |
18:01:18 | Amun-Ra | sort of |
18:01:21 | FromDiscord | <.kanaxa> It's sort of to cater to Python's "everything's an object" paradigm, and the Python object model |
18:02:02 | FromDiscord | <.kanaxa> So anyone who's funky enough gets to mess around with the classmaker |
18:02:11 | FromDiscord | <.kanaxa> (edit) "So anyone who's funky enough gets to mess around with the classmaker ... " added "directly" |
18:02:19 | FromDiscord | <Phil> Right, Django had those for creating instances of Objects that map to database rows |
18:02:29 | FromDiscord | <Phil> "Managers" or sth I think |
18:03:15 | FromDiscord | <.kanaxa> Exactly, but on the application level I never had to mess around with the metaclass stuff, it was well-insulated from general use |
18:03:25 | * | ajunior quit (Ping timeout: 245 seconds) |
18:03:45 | FromDiscord | <.kanaxa> I imagine if you're YouTube/Google-scale where you need to rip out all the internal piping of Django, that's where you get into mucking around with that classmaking stuff directly |
18:03:51 | FromDiscord | <Phil> Lucky you, whenever I had to troubleshoot some stuff in there it took a bit to break my brain into the correct shape to think in |
18:03:58 | FromDiscord | <.kanaxa> I recall an article in which I think the Instagram guys did that |
18:04:10 | FromDiscord | <Phil> At least from what I remember from my Django project before I rewrote it last year |
18:04:27 | FromDiscord | <Phil> (edit) "At least from what I remember from my Django project before I rewrote it last year ... " added "in nim" |
18:04:53 | FromDiscord | <.kanaxa> In reply to @isofruit "Lucky you, whenever I": I'm just a lowly programmer, haha |
18:05:05 | FromDiscord | <.kanaxa> And since I'm not a proefssional one, I get to pick my choice of languages to work in/learn |
18:05:20 | FromDiscord | <.kanaxa> (edit) "proefssional one," => "professional one (just an enthusiast)," |
18:05:28 | FromDiscord | <Phil> I honestly think nim can be a learning treasure trove for programming concepts in general |
18:05:54 | FromDiscord | <Phil> Like basically even if you decide to dive into something else later on the concepts you can slowly amass in nim remain relevant, other languages just have different syntax for it |
18:06:52 | FromDiscord | <.kanaxa> In reply to @isofruit "Like basically even if": I'm inclined to agree, it's like a large/more serious step up from the more relaxed (or do whatever you want) programming style of Python |
18:07:06 | FromDiscord | <.kanaxa> The concepts are both the same and different, and can be quite a stepping stone |
18:07:33 | FromDiscord | <Phil> compile time and running code there, metaprogramming (okay that might not be as relevant in a lot of langs), overloading, how generics work, templates (That for example is relevant for C++ which has something similar but more for classes than code-snippets), compilers, C-interop, static-typing in general etc. |
18:07:36 | FromDiscord | <.kanaxa> E.g. in Python, lists are dynamically-sized, in Nim arrays are fixed-size - that's just one more leaping spot to get to C level where you have to work with fixed-length items directly |
18:08:13 | FromDiscord | <Phil> In reply to @.kanaxa "E.g. in Python, lists": Well tbh like 99% of the time you use seq's anyway because working with fixed-size is a pain ^^' |
18:08:26 | FromDiscord | <.kanaxa> Haha, really? dang |
18:08:35 | FromDiscord | <Phil> But yeah that's also an important concept |
18:08:46 | FromDiscord | <Phil> In java that one would be Array vs. ArrayList |
18:09:36 | * | ajunior joined #nim |
18:10:56 | FromDiscord | <.kanaxa> And syntax-wise and ease of tooling, Nim just feels much better - e.g. I'm learning Swift currently, and the enormous amounts of closures and shorthand syntaxes are a bit of a turn-off at times (e.g. shorthand closures), oddities like twin parameter names, the rather fractured standard library ecosystem (different on Mac OS vs everywhere else), the fact that you _have_ to use XCode at some point |
18:11:18 | FromDiscord | <.kanaxa> With Nim I can get by on a text editor and a terminal and a simple curl install, it's so nice |
18:12:23 | FromDiscord | <.kanaxa> (edit) "And syntax-wise and ease of tooling, Nim just feels much better - e.g. I'm learning Swift currently, and the enormous amounts of closures and ... shorthandtimes," added "curly brackets and" | "times (e.g. shorthand closures)," => "times, plus" |
18:12:53 | FromDiscord | <.kanaxa> (edit) "And syntax-wise and ease of tooling, Nim just feels much better - e.g. I'm learning Swift currently, and the enormous amounts of closures and curly brackets and shorthand syntaxes are a bit of a turn-off at times, plus oddities like twin parameter names, the rather fractured standard library ecosystem (different on Mac OS vs everywhere else), the fact that you _have_ to use XCode at some point ... " added "which is like a 10+ |
18:13:38 | FromDiscord | <.kanaxa> Also the apple developer documentation is one of the most opaque documentation schemes I've ever read amongst all the languages, there are even apps built to supplement the official documentation |
18:14:14 | FromDiscord | <.kanaxa> At least I personally found it very difficult to understand, compared to Python's/Nim's docs |
18:14:15 | FromDiscord | <Phil> 😄 ↵Ah on the topic of things being opt in and not on a "Have to know" basis, basically just to drive the point home from Araq earlier:↵https://discord.com/channels/371759389889003530/768367394547957761/1137413636034416752↵> you don't have to learn nor use them if you don't want to but that applies to many other aspects of Nim as well: effect tracking, ptr hacking, "strict funcs" etc etc |
18:14:58 | FromDiscord | <Phil> (edit) "😄 ↵Ah on the topic of things being opt in and not on a "Have to know" basis, basically just to drive the point home ... from" added "here a quote" |
18:15:52 | FromDiscord | <.kanaxa> Great and very comforting reminder for newbies |
18:15:54 | FromDiscord | <.kanaxa> (edit) "Great and very comforting reminder for newbies ... " added "like me" |
18:15:57 | FromDiscord | <.kanaxa> (edit) "Great and very comforting reminder for ... newbies" added "Nim" |
18:16:03 | * | ajunior quit (Ping timeout: 246 seconds) |
18:22:57 | * | ajunior joined #nim |
18:29:15 | * | ajunior quit (Ping timeout: 245 seconds) |
18:33:17 | * | ajunior joined #nim |
18:41:15 | * | ajunior quit (Ping timeout: 246 seconds) |
18:50:02 | * | ajunior joined #nim |
18:58:25 | * | ajunior quit (Ping timeout: 245 seconds) |
19:02:03 | FromDiscord | <requiresupport> sent a code paste, see https://play.nim-lang.org/#ix=4Cuk |
19:02:41 | * | ajunior joined #nim |
19:03:24 | FromDiscord | <x.hat> In reply to @isofruit "Generally that's also the": TIL |
19:07:40 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4Cum |
19:07:46 | FromDiscord | <arathanis> returns true, "Done!" prints. |
19:08:38 | FromDiscord | <Phil> I would wager the do-stuff bits continuously raise an exception |
19:08:43 | * | lfanew joined #nim |
19:08:55 | * | ajunior quit (Ping timeout: 240 seconds) |
19:08:55 | FromDiscord | <arathanis> oh i figured it was literally a placeholder lol |
19:09:28 | FromDiscord | <arathanis> still prints done, even if I raise an exception though. |
19:09:31 | FromDiscord | <requiresupport> I have an echo under exception too, but don't see anything echoed, so assumed it works |
19:11:55 | FromDiscord | <requiresupport> nvm found the issue, this function was part of a module im importing and it kept building the old version of the function event after `nimble install` |
19:12:31 | * | ntat quit (Quit: leaving) |
19:15:41 | * | ajunior joined #nim |
19:21:51 | * | ajunior quit (Ping timeout: 246 seconds) |
19:26:57 | * | ajunior joined #nim |
19:33:00 | * | ajunior quit (Ping timeout: 245 seconds) |
19:35:21 | FromDiscord | <0xrh0d4m1n> hey guys, any ideas on better dealing with modules to avoid the "never-ending" `../../../../../` ? |
19:37:11 | FromDiscord | <0xrh0d4m1n> is there any example of implementing some sort of pre-defined relative path like: `@myPath/myModule` |
19:37:21 | FromDiscord | <0xrh0d4m1n> (edit) "is there any example of implementing some sort of pre-defined relative path like: `@myPath/myModule` ... " added "?" |
19:40:53 | * | ajunior joined #nim |
19:43:03 | FromDiscord | <bostonboston> you might be able to do something with `$projectpath` or `$projectdir` but ive never used them |
19:45:39 | FromDiscord | <bostonboston> or maybe `{.strdefine.}` |
19:45:56 | FromDiscord | <0xrh0d4m1n> In reply to @bostonboston "you might be able": I was thinking on implementing some sort of a `hub` where from this hub any module could get anyhing... idk |
19:46:54 | * | junaid_ quit (Quit: leaving) |
19:47:03 | * | ajunior quit (Ping timeout: 246 seconds) |
19:47:46 | FromDiscord | <bung8954> why not use project root |
19:48:03 | * | junaid_ joined #nim |
19:48:32 | FromDiscord | <bostonboston> yeah so potentially `const hubPath {.strdefine.}: string = "../"` and `nim c -d:hubPath=[path to hub]` |
19:48:54 | FromDiscord | <0xrh0d4m1n> In reply to @bung8954 "why not use project": it is getting hard, it is a project of projects, I will try the approach from suggested by @bostonboston |
19:49:09 | FromDiscord | <0xrh0d4m1n> In reply to @bostonboston "yeah so potentially `const": thank you 🙂 ❤️ |
19:49:35 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4CuM |
19:49:40 | FromDiscord | <bostonboston> ive never attempted to do that so if it does not work sorry |
19:50:22 | * | ajunior joined #nim |
19:52:16 | FromDiscord | <bung8954> I recommend use nim config file use can add include path |
19:54:13 | FromDiscord | <bostonboston> yep that sounds a lot cleaner than my method |
19:56:32 | * | junaid_ quit (Quit: leaving) |
19:57:23 | * | junaid_ joined #nim |
19:58:28 | * | ajunior quit (Ping timeout: 246 seconds) |
19:59:13 | * | junaid_ quit (Client Quit) |
20:00:57 | * | jmdaemon joined #nim |
20:01:49 | * | junaid_ joined #nim |
20:08:04 | FromDiscord | <x.hat> Does anyone know why the homebrew version of nim doesn't come with / build `testament`? |
20:09:13 | FromDiscord | <Phil> That's incredibly beyond me, apologies |
20:13:56 | FromDiscord | <jensl> In reply to @nasuray "my current setup uses": how did you install nim.nvim on lazyvim? im not a vim wiz soz |
20:14:19 | FromDiscord | <jensl> (edit) "on" => "using" |
20:14:35 | * | junaid_ quit (Quit: leaving) |
20:16:16 | * | junaid_ joined #nim |
20:18:37 | FromDiscord | <Elegantbeef> @Phil I do not fit the definition of professional in any regard, so of course! |
20:18:49 | FromDiscord | <Phil> I rest my case |
20:18:57 | FromDiscord | <System64 ~ Flandre Scarlet> Is it normal I have this error? https://media.discordapp.net/attachments/371759389889003532/1137479877604409444/image.png |
20:19:01 | FromDiscord | <Phil> Sidenote beef, doing my entire mapping idea via macro is just orders of magnitude simpler |
20:19:25 | FromDiscord | <Elegantbeef> Sure, it's even simplerif you just use a proc 😄 |
20:19:37 | FromDiscord | <Phil> I lliterally just generate a bunch of `x.fieldName = y.fieldName` statements and attach them to the body that is already there |
20:20:02 | FromDiscord | <Phil> Do a check first if x.fieldName already gets assigned to earlier in the body that was already written but that's basically the entire part of the complexity |
20:20:29 | FromDiscord | <Phil> Now I just need to expand it to also work for ref types, named tuples and then check if inheritance screws me over somewhere |
20:21:30 | FromDiscord | <Elegantbeef> System functions cannot access global state |
20:21:34 | FromDiscord | <Elegantbeef> That's impure |
20:21:54 | FromDiscord | <System64 ~ Flandre Scarlet> oh↵Even if it is read only? |
20:22:13 | FromDiscord | <Elegantbeef> Of course |
20:22:26 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
20:22:44 | FromDiscord | <Elegantbeef> What's this check like?↵(@Phil) |
20:22:54 | FromDiscord | <bostonboston> I think the best way to think about (im stealing this comment) is a func maps inputs to outputs, if it does more than that its not a func |
20:22:58 | FromDiscord | <Elegantbeef> Phil can you show an small example of a usage and typedefs? |
20:23:11 | FromDiscord | <System64 ~ Flandre Scarlet> Because I have this global var, but I want other modules to only be able to read it https://media.discordapp.net/attachments/371759389889003532/1137480942957633547/image.png |
20:23:22 | FromDiscord | <Elegantbeef> Right boston |
20:23:27 | FromDiscord | <Elegantbeef> So make it a proc? |
20:23:36 | FromDiscord | <Elegantbeef> A function has the exact same output for the input |
20:23:39 | FromDiscord | <Elegantbeef> They're mathematically pure |
20:23:41 | FromDiscord | <jensl> In reply to @nasuray "my current setup uses": I got nim.nvim to work |
20:23:44 | FromDiscord | <jensl> ty |
20:23:52 | FromDiscord | <Elegantbeef> `1 + 1 = 2` always |
20:24:06 | FromDiscord | <Elegantbeef> a pure function with no parameters will always return the same value |
20:24:12 | FromDiscord | <Elegantbeef> Otherwise it's impure |
20:24:15 | FromDiscord | <jensl> did you have this same thing where it collapses indented code ? |
20:24:23 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137481245400502352/image.png |
20:24:58 | FromDiscord | <Elegantbeef> `zR` jensl 😄 |
20:24:58 | FromDiscord | <Elegantbeef> PS\: `import std/[net, osproc, strformat]` |
20:25:02 | * | junaid_ quit (Remote host closed the connection) |
20:25:23 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Cv7 |
20:25:35 | FromDiscord | <jensl> In reply to @Elegantbeef "`zR` jensl 😄": zR?? |
20:25:43 | FromDiscord | <Elegantbeef> `template deltaTime: untyped = getDeltaTime()` |
20:26:20 | FromDiscord | <Elegantbeef> iirc zR unfolds |
20:26:21 | FromDiscord | <Elegantbeef> `z + R` |
20:26:21 | FromDiscord | <Elegantbeef> Whatever you prefer to write shortcuts as |
20:27:00 | FromDiscord | <jensl> ohh yes ty |
20:27:19 | FromDiscord | <jensl> but I don't even want it to do it in the first place 😅 |
20:27:33 | FromDiscord | <jensl> it's nim.nvim doing it right/ |
20:27:41 | FromDiscord | <jensl> (edit) "right/" => "right?" |
20:29:01 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "`template deltaTime: untyped =": Oh alright, thanks!↵Now the only problem is I can't use threads |
20:29:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cv8 |
20:29:12 | * | thomasross joined #nim |
20:29:40 | FromDiscord | <Phil> I also have the ability to use a `{.asMapper.}` pragma instead but I'm not final on what I want my desired syntax to be or what the naming for those should be |
20:29:55 | FromDiscord | <.maverk> hello wonderful people |
20:30:04 | FromDiscord | <.maverk> i am new to nim programming |
20:30:04 | FromDiscord | <Phil> as for how I perform my check, one sec |
20:31:23 | FromDiscord | <.maverk> what does ``^`` do in nim ? |
20:31:42 | FromDiscord | <Elegantbeef> Creates a BackwardsIndex |
20:31:58 | FromDiscord | <nasuray> In reply to @jensl "but I don't even": you can disable folding with `vim.opt.foldenable = false` |
20:33:09 | FromDiscord | <Phil> I have a proc that scans every statement in the body essentially for `result.<Field>` and puts those `<Field>` in a seq.↵If I iterate over the fields of B and `<Field>` shows up I just skip it because I now it has an explicit mapping already provided by the user |
20:33:53 | FromDiscord | <.maverk> In reply to @Elegantbeef "Creates a BackwardsIndex": how ? |
20:34:02 | FromDiscord | <.maverk> can i see an example ? |
20:34:02 | FromDiscord | <jensl> In reply to @nasuray "you can disable folding": I tried this |
20:34:05 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137483684086296576/image.png |
20:34:10 | FromDiscord | <jensl> but it doesn't work |
20:34:21 | FromDiscord | <Elegantbeef> `var a = ^1` |
20:34:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cva |
20:35:14 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4Cvb like phil this is the type of stuff I've been talking about this entire time |
20:35:20 | FromDiscord | <nasuray> In reply to @jensl "": It's not a package setting it's a global `vim` setting. you can see my config here https://git.dayl.in/daylin/dotfiles/src/branch/main/home/private_dot_config/nvim if it's helpful |
20:36:02 | FromDiscord | <jensl> ohh well it never folded untill I installed nim.nvim |
20:36:09 | FromDiscord | <jensl> ill check it out ty |
20:36:39 | FromDiscord | <Phil> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4Cvb like phil this": And you did not catch that the goal of that was a package.↵I want to be able to generate a full mapping proc including arbitrary assignments where I can not do simple `result.<field> = source.<field>` |
20:36:44 | FromDiscord | <Phil> If it were that simple I'd have written it that way |
20:37:30 | FromDiscord | <nasuray> In reply to @jensl "ohh well it never": The folding is set by `nvim/vim` the plugin is just telling it how it would fold a `.nim` file. If you want to only disable the behavior for specific file types you can use autocommands |
20:37:37 | FromDiscord | <scarlettalice> https://t.me/+baBKNFRxd78wNDU0 |
20:37:40 | FromDiscord | <Phil> The key is that the entire thing is basically the proc you wrote together with user defined statements for custom assignments if they need it (or must provide in cases where e.g. `B` has a field that `A` does not, you must provide behaviour for how that field is supposed to be field in those scenarios) |
20:38:24 | FromDiscord | <Phil> Don't worry, I'm on that ban, give me a sec to get into matrix |
20:38:53 | FromDiscord | <Phil> There you go |
20:39:44 | FromDiscord | <.maverk> In reply to @Elegantbeef "`var a = ^1`": it doesn't work |
20:40:16 | FromDiscord | <Elegantbeef> it does |
20:40:31 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1137485307307102308/Capture.PNG |
20:40:35 | FromDiscord | <.maverk> look |
20:40:39 | FromDiscord | <.maverk> i got an error |
20:40:44 | FromDiscord | <Elegantbeef> Yea look at the error |
20:40:53 | FromDiscord | <Elegantbeef> There is no `$` defined for a backwards index |
20:40:56 | FromDiscord | <.maverk> what should i do now ? |
20:40:57 | FromDiscord | <Phil> It errors because a backwards index can not be echo'd |
20:41:16 | FromDiscord | <.maverk> what should i do in this situation |
20:41:26 | FromDiscord | <.maverk> can you give me a working example |
20:41:26 | FromDiscord | <Phil> Just use it, no echo |
20:41:27 | FromDiscord | <.maverk> ? |
20:41:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cvf |
20:42:41 | FromDiscord | <Phil> Not every type or variable is stringifiable with `$` in nim↵Nim does have something called `repr` which always works, but is solely intended for debugging |
20:42:44 | FromDiscord | <.maverk> how did you get nim> ? |
20:42:49 | * | lfanew quit (Quit: Leaving.) |
20:43:05 | * | nils` joined #nim |
20:43:07 | FromDiscord | <Phil> I use inim which is a terminal application to execute nim lines of code as if it were a python shell |
20:43:21 | FromDiscord | <Phil> Basically that's called a REPL |
20:43:35 | FromDiscord | <.maverk> are using replit ? |
20:43:44 | FromDiscord | <.maverk> (edit) "using" => "u u sing" |
20:43:51 | FromDiscord | <.maverk> (edit) "u sing" => "using" |
20:43:52 | FromDiscord | <Phil> No, just inim, it's... a nimble package I think |
20:44:06 | FromDiscord | <jensl> In reply to @nasuray "you can disable folding": done, ty |
20:44:14 | FromDiscord | <.maverk> it doesn't work i ried typing inim |
20:44:16 | FromDiscord | <Phil> Unironically one incredibly useful piece of software for me |
20:44:51 | FromDiscord | <Phil> Of course not, inim is a package you need to install, not part of nim by default |
20:45:05 | FromDiscord | <.maverk> In reply to @isofruit "Of course not, inim": how to install it |
20:45:07 | FromDiscord | <.maverk> ? |
20:46:40 | FromDiscord | <Phil> In reply to @.maverk "how to install it": generally to look for nimble packages you can `nimble search <searchTerm>`↵To install a package such as inim, you can `nimble install <packageName>` |
20:47:17 | FromDiscord | <Phil> For further questions about features of nimble, here's the docs about it:↵https://github.com/nim-lang/nimble#readme |
20:47:47 | FromDiscord | <.maverk> now i understand the ^ operator |
20:48:36 | FromDiscord | <.maverk> instead of indexing from 0 it starts indexig from the last object in the list |
20:49:29 | FromDiscord | <Phil> Aye, it's pretty much identical in concept to python's "-1" index |
20:50:25 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cvm |
20:50:38 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Cvm" => "https://play.nim-lang.org/#ix=4Cvn" |
20:51:48 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4Cvo |
20:51:57 | FromDiscord | <.maverk> but it doesn't work here 😅 |
20:52:08 | FromDiscord | <.maverk> i should be getting ``d`` |
20:52:38 | FromDiscord | <.maverk> or works only with arrays ? |
20:52:42 | * | om3ga quit (Read error: Connection reset by peer) |
20:53:08 | FromDiscord | <Phil> No, you just can't start backwards indexing with 0 |
20:53:55 | FromDiscord | <Phil> See my earlier examples. I took the last elements of lists/seq's but the backwards index in both cases (python and nim) started with 1 |
20:53:59 | * | om3ga joined #nim |
20:54:17 | FromDiscord | <Phil> So it works exactly as intended 😉 |
20:54:32 | FromDiscord | <.maverk> i see i see now |
20:54:42 | FromDiscord | <.maverk> very nice brother |
20:55:31 | FromDiscord | <Phil> Just play around with your code more and try to troubleshoot a bit yourself |
21:08:44 | FromDiscord | <Phil> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4Cvb like phil this": Scrolling down is my flipping friend >_> <_> |
21:08:49 | FromDiscord | <Phil> (edit) ">_> <_>" => ">\_> <\_>" |
21:09:34 | FromDiscord | <Phil> Eh, still feel tempted to have a pragma just so the user has to think less about applying mapTo |
21:09:54 | FromDiscord | <Phil> And because new toy play around and so on |
21:10:21 | FromDiscord | <Phil> (edit) "In reply to @Elegantbeef "https://play.nim-lang.org/#ix=4Cvb like phil this": Scrolling down ... is" added "on play nim-lang" |
21:10:56 | FromDiscord | <.kanaxa> Eh just wondering if there's the utmost simplest tutorial for DSL/macros around to play with? |
21:11:03 | FromDiscord | <.kanaxa> Something to wet my beak with |
21:11:25 | FromDiscord | <.kanaxa> Doesn't have to be complex or do much, but at least a way to mess around with ASTs |
21:13:28 | FromDiscord | <Phil> sent a long message, see http://ix.io/4Cvx |
21:14:16 | FromDiscord | <.kanaxa> I read the entire chapter in Nim in Action, it started great, but halfway through it went into the Draw The Rest of the Owl mode, completely left me confounded |
21:14:25 | FromDiscord | <Phil> For me the starting point was none of those.↵It was the realization after having talked a bunch about them that every word, every sign, is a NimNode.↵And every syntax construct, is a very fixed pattern of NimNodes |
21:14:44 | FromDiscord | <.kanaxa> In reply to @isofruit "For me the starting": Hmmmm, that's really interesting |
21:15:04 | FromDiscord | <.kanaxa> So basically we're just reconstructing nodes |
21:15:06 | FromDiscord | <Phil> You can see a bunch of syntax constructs and what NimNode pattern they turn into in std/macros |
21:15:37 | FromDiscord | <.kanaxa> Alright work with me on this one, let's say we wanted to do something crazy |
21:15:42 | FromDiscord | <Phil> Basically the compiler already knows how to turn `proc x(y: int): string = $y` into a sequence pattern of nim-nodes that it can work with |
21:15:49 | FromDiscord | <.kanaxa> Let's just say: I wanted to write a fictional fantasy novel with Nim |
21:16:02 | FromDiscord | <.kanaxa> In a strict DSL fashion |
21:16:08 | FromDiscord | <.kanaxa> Would that be possible by rewriting the AST? |
21:16:10 | FromDiscord | <Phil> Via macros you can define how to transform some input A into that same sequence pattern of nimnodes and thus generate a proc |
21:16:54 | FromDiscord | <Phil> In reply to @.kanaxa "Would that be possible": I mean, yeah. You can turn anything into a DSL.↵As long as you can define the rules on how to turn any input X into the magical sequence of NimNodes for a given syntax construct, you can transform it |
21:17:06 | FromDiscord | <.kanaxa> sent a long message, see http://ix.io/4Cvy |
21:17:14 | FromDiscord | <.kanaxa> Would this be a possibly valid syntax in Nim? |
21:17:23 | FromDiscord | <.kanaxa> With the implementation details to be filled in later |
21:17:41 | FromDiscord | <.kanaxa> But could the above be used to generate say, novels, by trope-y variations, using DSLs? |
21:18:07 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cvz |
21:18:15 | FromDiscord | <.kanaxa> Absolutely fascinating |
21:18:18 | FromDiscord | <Phil> Note though that transforming stuff in that manner can be very, very tedious |
21:18:23 | FromDiscord | <.kanaxa> The only question then is --- why not use functions |
21:18:40 | FromDiscord | <.kanaxa> From what I understand: because functions can't rewrite grammar, you're still stuck to vanilla Nim |
21:18:55 | FromDiscord | <.kanaxa> With macros, Nim becomes a different language in itself thanks to the DSL change |
21:18:56 | FromDiscord | <.kanaxa> Am I right? |
21:19:29 | FromDiscord | <Elegantbeef> Functions have limited introspection capabilities and you cannot rewrite the AST to anything |
21:19:29 | FromDiscord | <Phil> Yees-ish with some limitations.↵Like you won't get rid of indentation for example.↵Or the fact that pragmas are necessary.↵Or the proc keyword. |
21:19:40 | FromDiscord | <.kanaxa> Fair enough |
21:19:54 | FromDiscord | <.kanaxa> but I'm excited about the possibilities |
21:20:00 | FromDiscord | <Phil> You can certainly make things very mutable, more mutable than a lot of other langs |
21:20:30 | FromDiscord | <Phil> Actually I'm not aware of any other languages this mutable... C maybe? |
21:20:34 | FromDiscord | <.kanaxa> Like I play music, what if I recreated DSL for writing music, so that I could compose music in a specific DSL that could then export to sheet music or tablatures |
21:20:49 | FromDiscord | <Elegantbeef> Rust has token macros |
21:20:57 | FromDiscord | <Elegantbeef> you can embed other languages into rust due to its macros |
21:21:06 | FromDiscord | <Phil> I stand corrected |
21:21:24 | FromDiscord | <Elegantbeef> Valid rust |
21:21:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/VyBml |
21:21:48 | FromDiscord | <.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4CvB |
21:21:53 | FromDiscord | <.kanaxa> The Rust code seems quite succinct |
21:21:54 | FromDiscord | <Elegantbeef> Nim doesnt have token macros |
21:21:57 | FromDiscord | <Phil> In reply to @.kanaxa "Like I play music,": Completely possible, however a "lang" for generating and playing the generated music already exists ^^ |
21:22:01 | FromDiscord | <Elegantbeef> So you'd have to do the `parse` variation |
21:23:01 | FromDiscord | <Phil> (edit) "In reply to @.kanaxa "Like I play music,": Completely possible, however a "lang" for generating and playing the generated music already exists ... ^^" added "(Sonic Pi)" |
21:24:08 | FromDiscord | <.kanaxa> In reply to @isofruit "Completely possible, however a": Oh wow! |
21:24:36 | FromDiscord | <Elegantbeef> https://github.com/vitreo12/omni |
21:28:46 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137497452652544110/image.png |
21:28:54 | FromDiscord | <jensl> how do I tell nvim what the root dir is? |
21:33:07 | FromDiscord | <nasuray> In reply to @jensl "": you switched to nim_langserver? also are you in a project that has a `<project>.nimble` the root directory isn't relevant if you are operating on a single file and not a library or package |
21:33:52 | * | Torr joined #nim |
21:33:57 | FromDiscord | <jensl> In reply to @nasuray "you switched to nim_langserver?": yea bc your config had nim_langserver and nimlsp didn't work even when it said it did |
21:34:16 | FromDiscord | <jensl> but do I have to add a `.nimble` folder to every project?? |
21:35:04 | FromDiscord | <jensl> when I install using nimble rn everything goes to `C:\Users\ME\.nimble` |
21:35:35 | FromDiscord | <Phil> There should only be one .nimble dir, but every project should have a <project>.nimble file |
21:35:59 | * | PMunch joined #nim |
21:36:20 | FromDiscord | <jensl> wait is there a way to make a nim project just like `cargo new` ? |
21:36:31 | FromDiscord | <jensl> or do I have to manually make a file |
21:36:42 | FromDiscord | <Phil> nimble init |
21:37:27 | FromDiscord | <nasuray> In reply to @jensl "yea bc your config": Ah my nvim config might be out of sync then because I switched back to `nimlsp` |
21:38:15 | FromDiscord | <jensl> In reply to @isofruit "nimble init": https://media.discordapp.net/attachments/371759389889003532/1137499837189869659/image.png |
21:38:24 | FromDiscord | <jensl> Im just trynna write a script here 💀 |
21:38:58 | FromDiscord | <Phil> In that case license doesn't matter, it in the end just copy pastes a txt file in and types it into the nimble file |
21:39:08 | FromDiscord | <jensl> okay well I did it |
21:39:10 | FromDiscord | <jensl> but |
21:39:25 | FromDiscord | <jensl> root dir not found |
21:39:48 | FromDiscord | <jensl> and I have a nim.nimble |
21:39:55 | FromDiscord | <jensl> src/nim.nim |
21:40:09 | FromDiscord | <Phil> I mean regarding root dir I can't help, I don't do nimlsp, Pmunch might. |
21:40:32 | FromDiscord | <Phil> I stated what I could about initializing nim projects ^^' |
21:40:50 | FromDiscord | <jensl> yes I didn't know that either ty :) |
21:41:12 | FromDiscord | <nasuray> I would pick a different name for your files lol and FWIW the language server doesn't need to have a root directory if you are only writing one file |
21:42:10 | FromDiscord | <jensl> I just quickly tried that nimble init |
21:42:24 | FromDiscord | <jensl> but if it doesn't need a root dir why doesn't the lang server work |
21:42:35 | FromDiscord | <jensl> it says this when I open a .nim file |
21:42:37 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137500935900368936/image.png |
21:43:10 | FromDiscord | <jensl> In reply to @jensl "": and 0 clients are attached |
21:43:53 | FromDiscord | <nasuray> you'll need to check the lsp.log to find out why it specifically crashes |
21:44:02 | FromDiscord | <nasuray> what version of nim are you using? |
21:44:13 | FromDiscord | <jensl> 2.0.0 |
21:44:40 | * | PMunch_ joined #nim |
21:45:00 | FromDiscord | <nasuray> It crashes often though it's seemed more stable with 2.0 for me |
21:45:52 | FromDiscord | <jensl> there's no way it's installed correctly, it hasnt worked a single time yet |
21:46:09 | FromDiscord | <jensl> In reply to @nasuray "you'll need to check": where is lsp.log? 😬 |
21:46:27 | FromDiscord | <nasuray> not totally sure on windows |
21:47:06 | * | PMunch quit (Ping timeout: 246 seconds) |
21:47:37 | FromDiscord | <jensl> found it |
21:48:23 | FromDiscord | <jensl> idk if I should paste here |
21:48:29 | FromDiscord | <jensl> sent a long message, see http://ix.io/4CvG |
21:50:48 | FromDiscord | <nasuray> sent a code paste, see https://play.nim-lang.org/#ix=4CvH |
21:52:07 | FromDiscord | <jensl> maybe im just weird for using system33, idk |
21:55:26 | FromDiscord | <jensl> I fixed the root dir now and it makes no difference indeed |
21:57:51 | FromDiscord | <jensl> @nasuray what happens if you type `nimlangserver` in your terminal? |
21:58:08 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137504842709991625/image.png |
22:00:10 | * | hohlerde joined #nim |
22:04:05 | * | PMunch_ quit (Read error: Connection reset by peer) |
22:11:56 | FromDiscord | <jensl> I tried reinstalling and it gave this error |
22:11:58 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137508321042112653/image.png |
22:12:12 | FromDiscord | <jensl> (edit) "error" => "warning, might be the cause" |
22:12:13 | FromDiscord | <jensl> https://media.discordapp.net/attachments/371759389889003532/1137508385701498900/image.png |
22:16:41 | * | disso-peach quit (Quit: Leaving) |
22:27:03 | FromDiscord | <jensl> even after reinstalling nim :/ |
22:40:29 | * | cedb quit (Ping timeout: 260 seconds) |
22:42:29 | FromDiscord | <Phil> Can you quote do something with a identifier from a variable? |
22:43:13 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CvP |
22:43:20 | * | lucasta joined #nim |
22:44:10 | * | lucasta quit (Remote host closed the connection) |
22:44:35 | * | lucasta joined #nim |
22:45:49 | FromDiscord | <Phil> Actually what am I saying, I can just manipulate the nimnode I get out of the quote do |
22:48:59 | * | Torr quit (Quit: Torr) |
22:53:47 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4CvQ |
22:55:48 | FromDiscord | <Elegantbeef> You are mutating `x` and passing it as mutable |
22:56:13 | FromDiscord | <voidwalker> ok so this is an acceptable way to modify global vars with a func.. hmm |
22:57:58 | FromDiscord | <odexine> Well because you’re passing it in |
22:58:02 | FromDiscord | <bostonboston> It fits the definition of {.noSideEffect.} according to the manual |
22:58:15 | FromDiscord | <bostonboston> https://nim-lang.org/docs/manual.html#effect-system-side-effects |
22:58:27 | FromDiscord | <odexine> You’re explicitly telling Nim that you’re giving the function the ability to modify the parameter |
22:58:52 | FromDiscord | <odexine> At least IIRC that’s the justification given for it not being a side effect |
22:59:21 | FromDiscord | <odexine> And technically yes, it isn’t a side effect since it’s explicit |
22:59:39 | FromDiscord | <odexine> You can kinda equate it to a monad I guess |
23:16:04 | * | thomasross quit (Remote host closed the connection) |
23:16:28 | * | thomasross joined #nim |