00:50:49 | FromDiscord | <Alea> why does --app:gui link a whole ton of win32 libs? |
00:51:02 | FromDiscord | <Alea> I just want to hide the cmd prompt that pops up |
00:53:55 | FromDiscord | <Alea> er actually it happens sometimes even without that option |
00:54:46 | FromDiscord | <Alea> sent a code paste, see https://play.nim-lang.org/#ix=3ugy |
01:01:42 | FromDiscord | <reilly> Trying to help my (less technically inclined friend) install Nim. They're unwilling to disable Windows Defender, which keeps flagging Testament as malicious, so I told him how to compile it himself. We're nearly there, it's just that nimble keeps throwing `could not load: (libcrypto-1_1-x64|libeay64).dll` every time he tries to run it. Not really sure what to do about this, since we're on Windows and can't just `apt-get` something. |
01:03:33 | FromDiscord | <ElegantBeef> The zips you can download should have the dlls you can plop down |
01:04:55 | FromDiscord | <juan_carlos> If is just learning probably wont need Testament just yet... :p |
01:09:31 | FromDiscord | <reilly> In reply to @ElegantBeef "The zips you can": In what folder, though? |
01:10:06 | FromDiscord | <Elegantbeef> Next to the nimble binary i'd imagine |
01:31:47 | FromDiscord | <reilly> In reply to @ElegantBeef "The zips you can": I have that DLL in Nim's bin folder now, but running `nimble` gives the same error... I don't have libeay64 (and I can't seem to find a download anywhere!) but I would at least expect it to only say libeay64 if it was able to find libcrypto... |
01:38:03 | FromDiscord | <reilly> https://media.discordapp.net/attachments/371759389889003532/869755551255523398/libs.zip |
01:39:59 | FromDiscord | <reilly> Well, I solved the problem by just sending him every .dll in my nimble bin folder. That's one way of doing it, I guess. |
02:00:29 | FromDiscord | <generic linux user> 🙂. |
02:20:53 | * | arkurious quit (Quit: Leaving) |
02:40:21 | FromDiscord | <SirJosh> In reply to @Alea "why does --app:gui link": if you specify you want a GUI application, nim will hook into the right libraries to ensure that you can use graphics libraries↵linking to those libs on windows shouldn't be an issue, especially anything win32 related (since those are pretty much guaranteed to be on all windows systems) |
02:44:13 | * | vicfred joined #nim |
03:38:34 | * | rockcavera quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:34 | * | supakeen joined #nim |
04:18:44 | * | thunder quit (Ping timeout: 265 seconds) |
04:43:23 | FromDiscord | <saem> Then that's recoverable, crashing out a users program isn't a great library decision. Basically always a bad idea. |
05:08:48 | FromDiscord | <bolino> Hello! Do you know how to transform a JsonNode into a string? |
05:09:28 | FromDiscord | <Rika> $ |
05:09:32 | FromDiscord | <bolino> I tried `.getStr()` but it return an empty string. |
05:09:32 | FromDiscord | <Elegantbeef> you can do `$` or `pretty` |
05:09:47 | FromDiscord | <Rika> One is uglified the other is self explanatory |
05:10:01 | FromDiscord | <Rika> Pick your poison |
05:10:17 | FromDiscord | <bolino> Oh, OK! Stupid me. Thanks a lot. |
05:12:21 | FromDiscord | <Rika> Honestly though I think .string should work similarly to $ |
05:12:40 | FromDiscord | <Rika> Hmm |
05:13:14 | FromDiscord | <Rika> It would be inconsistent with what Nim does with other types though I guess |
05:37:04 | FromDiscord | <reilly> Does anyone know how to handle collision (Area2D, CollisionShape2D) in Godot-Nim? |
05:40:02 | FromDiscord | <Rika> Might be more appropriate for #gamedev |
06:20:29 | * | neceve joined #nim |
06:43:18 | * | Kostrak joined #nim |
06:49:10 | FromDiscord | <planetis> Well not sure about it if a signal fails and another thread is in a wait, then a sentinel will not be reached, i think so. |
06:50:56 | FromDiscord | <planetis> unless it is awaken somehow |
06:51:56 | FromDiscord | <planetis> I am not sure thats why i am asking here, in case someone knows |
06:54:02 | FromDiscord | <saem> My point is that, as a strong default, unless you know exceptionally well don't make these types of decisions in libraries. |
06:57:32 | * | max22- joined #nim |
06:59:59 | FromDiscord | <Rika> You have to be really sure that you cannot recover before you raise a defect |
07:44:34 | * | Kostrak quit (Quit: Leaving) |
08:29:07 | fn | <ForumUpdaterBot99> New thread by Rforcen: PIG's, see https://forum.nim-lang.org/t/8278 |
08:38:02 | * | max22- quit (Ping timeout: 245 seconds) |
08:56:35 | * | pro joined #nim |
09:05:23 | * | pro quit (Quit: WeeChat 3.2) |
09:15:14 | * | Vladar joined #nim |
09:47:48 | * | pro joined #nim |
10:18:44 | FromDiscord | <@hjarausch_gitlab-5fa43a7bd73408> Debian package for recent Nim version? The recent stable Debian Bullseye version provides Nim-1.4.2 only. Is there any site where I can get a .deb package for Nim-1.4.8? many thanks for a hint. |
10:31:14 | FromDiscord | <generic linux user> its not that hard to build though |
10:31:42 | FromDiscord | <generic linux user> and, you shall download the latest rpm from opensuse and use alien to convert it to deb and install |
10:34:42 | FromDiscord | <generic linux user> In reply to @@hjarausch_gitlab-5fa43a7bd73408 "Debian package for recent": do you really need a deb file specifically , you can get it installed from the nightlies |
10:38:11 | * | max22- joined #nim |
10:45:44 | FromDiscord | <@hjarausch_gitlab-5fa43a7bd73408> Thanks, but Nim on OpenSuse is even older (1.2) |
10:46:05 | * | pro quit (Quit: WeeChat 3.2) |
10:50:18 | FromDiscord | <generic linux user> then fedora |
10:50:27 | FromDiscord | <generic linux user> and also nightlies |
10:51:24 | FromDiscord | <generic linux user> <https://github.com/nim-lang/nightlies/releases> |
11:12:19 | * | aeverr quit (Quit: i) |
11:39:36 | * | arkurious joined #nim |
11:44:51 | FromDiscord | <gerwy> does anyone know something similar to this https://github.com/gobuffalo/packr↵but made for nim? |
11:45:18 | FromDiscord | <gerwy> what i need is to include assets inside of the binary |
11:45:30 | FromDiscord | <gerwy> to have single exec with all the stuff inside |
11:50:00 | FromDiscord | <Rika> xmonader/nimassets |
11:50:38 | FromDiscord | <Rika> or just `const xxx = staticread("thefilename")` i guess would work too? |
11:50:56 | FromDiscord | <gerwy> In reply to @Rika "xmonader/nimassets": :OO |
11:51:24 | FromDiscord | <gerwy> the first one is cool |
11:51:42 | FromDiscord | <gerwy> i will try other one too i didn't know about that function thaaaanks |
11:52:07 | FromDiscord | <gerwy> there is idea for a game jam so i look for solutions already to not waste time hah |
11:52:27 | FromDiscord | <Rika> do game jams have limits other than time? |
11:52:41 | FromDiscord | <Rika> i remember some sort of game jam that had filesize limits, i forgot the name |
11:52:48 | FromDiscord | <Rika> one was 4kb and another was 1kb afaik |
11:52:51 | FromDiscord | <Rika> dont remember |
11:54:02 | FromDiscord | <gerwy> In reply to @Rika "do game jams have": yeah, im in community of (already finished sorry :< ) 4MB game jam where the limit was that the entire game couldn't be above 4mb including assets and everything |
11:54:38 | FromDiscord | <gerwy> and now because it ended we think about more ideas for games , the people there are so skilled i feel dumb there |
11:55:31 | FromDiscord | <gerwy> there is already a lot of ideas, one of the best i think is 1MB game jam |
11:55:53 | FromDiscord | <gerwy> but also 256KB game and only a single executable |
11:57:36 | FromDiscord | <Rika> 256kb sounds fun |
11:57:51 | FromDiscord | <enthus1ast> tja |
11:57:56 | FromDiscord | <Rika> tja? |
11:58:09 | FromDiscord | <gerwy> ye |
11:58:29 | FromDiscord | <gerwy> because 4MB was kinda a loot to work with haha, a lot of people did games below 100KB↵if i finished my game i would be in like 170KB with all the assets, code and some basic sfx |
11:59:06 | FromDiscord | <gerwy> it was a good opportunity to learn nim so thats how i started↵with all the compiler parameters i could to optimize by size and then use upx on it with lzma |
11:59:34 | FromDiscord | <gerwy> In reply to @Rika "256kb sounds fun": exactly i think it could be very cool, but the problem is that the lower you go the harder it gets to include any sfx or music |
12:00:34 | FromDiscord | <Rika> some games do away with such a thing and its ok |
12:00:46 | FromDiscord | <Rika> imo i would rather no bgm over a very repetitive one |
12:01:05 | FromDiscord | <gerwy> there was idea to make proc generated game jam↵where all the assets needs to be generated with code |
12:04:00 | * | max22- quit (Ping timeout: 276 seconds) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:34 | * | supakeen joined #nim |
12:07:47 | FromDiscord | <Rika> music cant easily be generated that way |
12:19:07 | FromDiscord | <gerwy> well thats your problem then, the size wouldn't be the limit then |
12:26:47 | federico3 | @hjarausch_gitlab-5fa43a7bd73408 an updated package is in the Debian Experimental archive |
12:27:44 | federico3 | (1.4.8) |
12:31:10 | FromDiscord | <generic linux user> experimental!! |
12:31:20 | federico3 | what? |
12:39:14 | * | pro joined #nim |
12:53:39 | FromDiscord | <@hjarausch_gitlab-5fa43a7bd73408> @\_discord\_709044657232936960\_federico3 From my stable Debian release (Bullseye) it's not possible to use |
12:54:32 | FromDiscord | <@hjarausch_gitlab-5fa43a7bd73408> apt -t experimental install nim. I have to search for a means to get a .deb file, or I will resort to build Nim from source (GIT) |
12:55:31 | federico3 | Bullseye is not released yet. Once it is released I'll backport 1.4.8 to it |
12:56:25 | * | Freneticks joined #nim |
12:57:07 | federico3 | besides, I just tried installing it from experimental and it worked |
12:58:25 | federico3 | you can also just grab the .deb from https://packages.debian.org/experimental/nim if you don't want to configure apt |
12:58:42 | * | max22- joined #nim |
12:58:55 | * | emery quit (Read error: Connection reset by peer) |
12:58:56 | * | ehmry joined #nim |
12:59:12 | Freneticks | i'm discovering nim, so I just nimble install lib but when i run nim compile --run it's say : Error: cannot open file: sdl2. I'm confused, someone can show me the path ? |
12:59:19 | FromDiscord | <generic linux user> whyy backport |
13:03:51 | FromDiscord | <@hjarausch_gitlab-5fa43a7bd73408> Many thanks to frederico3 |
13:14:00 | FromDiscord | <vindaar> Freneticks\: the nim library for sdl2 is only a wrapper around the C library that is sdl2. you need the shared library of that, which is then loaded at runtime. search for how to install sdl2 on your distribution |
13:18:19 | FromDiscord | <SolitudeSF> error indicates that nim cant find the module |
13:18:46 | Freneticks | it seems it's about the nim lib not the C lib (i already have it since i can compile CPP example) |
13:20:42 | * | max22- quit (Ping timeout: 276 seconds) |
13:26:47 | FromDiscord | <vindaar> ah, you're right. sorry on the phone and didn't read properly 🤦♂️ |
13:28:27 | FromDiscord | <vindaar> what does `nimble path sdl2` say for you? if it can't find anything doing a `nimble install sdl2` should be all. just keep in mind that there's like 3 (or more) different sdl2 wrappers |
13:31:42 | * | Vladar quit (Remote host closed the connection) |
13:32:30 | * | pro quit (Quit: WeeChat 3.2) |
13:39:11 | Freneticks | vindaar working sdl2 but the wraper i use is not found -> sdl2_nim |
13:41:08 | Freneticks | I mean i can nimble install sdl2_nim, but nimble path sdl2_nim : Error: At least one of the specified packages was not found |
13:45:39 | FromDiscord | <vindaar> but nimble install seems like it's working correctly? |
13:46:26 | Freneticks | yeah |
13:47:19 | FromDiscord | <vindaar> maybe there's some weirdness with the name of the package? |
13:48:58 | Freneticks | probably because there is some issue on the github about that but i'm too much ignorant about the nim way of handle this, so not sure what to do >< |
13:52:02 | FromDiscord | <vindaar> I'm seeing that the module needs to be imported as `sdl2nim`. so maybe `nimble path sdl2nim` would show the correct path |
13:52:08 | FromDiscord | <vindaar> eg here https://github.com/Vladar4/sdl2_nim/blob/master/examples/ex101_init.nim |
13:53:04 | FromDiscord | <vindaar> Also this seems related https://github.com/Vladar4/sdl2_nim/issues/35 |
13:54:52 | * | thunder joined #nim |
14:08:15 | * | Riceberry quit (Quit: Client closed) |
14:19:30 | * | rockcavera joined #nim |
14:19:30 | * | rockcavera quit (Changing host) |
14:19:30 | * | rockcavera joined #nim |
14:30:18 | * | max22- joined #nim |
14:31:22 | Freneticks | i have the same error with sdl2nim and yeah i already tried to compile the example |
14:31:27 | Freneticks | but i have the not found error |
14:34:19 | * | max22- quit (Remote host closed the connection) |
14:34:38 | * | max22- joined #nim |
14:38:32 | fn | <ForumUpdaterBot99> New thread by Xigoi: What is the difference between `quote do:` and just `quote:`?, see https://forum.nim-lang.org/t/8279 |
14:53:31 | FromDiscord | <enthus1ast> Wrong channel 😁↵(@Rika) |
14:53:52 | FromDiscord | <Rika> ah i see |
14:57:25 | FromDiscord | <lamersc.com 🐧> Could someone explain what a cycle collector is? |
14:57:45 | FromDiscord | <konsumlamm> it collects reference cycles |
14:57:50 | FromDiscord | <lamersc.com 🐧> I’ve seen people saying orc has it, but don’t fully understand what it is |
14:57:56 | FromDiscord | <Rika> whats the part that you dont understand |
14:58:05 | * | max22- quit (Ping timeout: 268 seconds) |
14:58:58 | FromDiscord | <lamersc.com 🐧> What exactly is a reference cycle 😅 |
14:59:33 | * | max22- joined #nim |
14:59:40 | FromDiscord | <lamersc.com 🐧> Probably sound like an idiot, but just trying to make more sense of it |
15:00:43 | FromDiscord | <konsumlamm> if object A refers to object B and object B refers to A |
15:01:05 | FromDiscord | <Rika> In reply to @lamersc.com 🐧 "Probably sound like an": we all sound like idiots to at least someone in this world |
15:01:12 | FromDiscord | <konsumlamm> reference counting won't collect them, since the refcount of each object is at least 1 |
15:01:37 | FromDiscord | <konsumlamm> so if noone else has a reference to A or B, it could be collected |
15:01:44 | FromDiscord | <konsumlamm> which is the job of the cycle collector |
15:02:16 | FromDiscord | <lamersc.com 🐧> Okay, that makes much more sense now |
15:02:50 | FromDiscord | <Rika> the catch with orc is that it makes it "nondeterministic" meaning that it's "unpredictable" in a way |
15:02:58 | FromDiscord | <Rika> because of the cycle collector |
15:03:44 | FromDiscord | <lamersc.com 🐧> That’s much more clear now 😅 I got so confused with it when originally reading on the docs |
15:03:44 | FromDiscord | <Rika> In reply to @Rika "the catch with orc": this makes it difficult to use in realtime systems, where if something doesnt happen at exactly this precise time, the system fails |
15:04:05 | FromDiscord | <Rika> which is why there's both arc and orc |
15:04:17 | FromDiscord | <lamersc.com 🐧> It’d be a better bet to use orc for something, say an HTTP server in that sense then |
15:04:21 | FromDiscord | <Rika> yes |
15:04:30 | FromDiscord | <lamersc.com 🐧> And arc in an embedded/OS environment? |
15:04:33 | FromDiscord | <Rika> yes |
15:04:47 | FromDiscord | <Rika> or audio processing |
15:05:13 | FromDiscord | <lamersc.com 🐧> Thanks for clearing things up for me 😅 I was searching around, but couldn’t find much straight forward answers |
15:05:23 | FromDiscord | <Rika> well, i guess audio processing is soft realtime (something happening late degrades the system but it does not fail) |
15:05:49 | federico3 | or just ARC |
15:06:54 | FromDiscord | <lamersc.com 🐧> @Rika @konsumlamm thank for your explaining 😄 |
15:27:23 | arkanoid | Just out of curiosity, which backend would you add to nim and why? |
15:28:36 | fn | <Prestige99> As in, a _new_ backend? |
15:29:02 | FromDiscord | <Rika> i wouldnt, if i had the resources to add a backend i would fix bugs with it instead |
15:29:17 | fn | <Prestige99> ^ agreed |
15:29:28 | FromDiscord | <PsychoClay> php maybe |
15:29:31 | fn | <Prestige99> or maybe build out better js support |
15:29:47 | FromDiscord | <Rika> better js support could be nice but i cant see much issues with it now |
15:29:52 | FromDiscord | <Rika> In reply to @PsychoClay "php maybe": well why? |
15:30:13 | FromDiscord | <PsychoClay> because i dont like php syntax |
15:30:17 | FromDiscord | <PsychoClay> and prefer nim's |
15:30:25 | arkanoid | Why don't improve llvm support and then go from llvm to web via emscripten? |
15:30:29 | FromDiscord | <Rika> i mean you could jsut write to C... |
15:30:46 | FromDiscord | <Rika> php is a server language though |
15:31:17 | arkanoid | You should really hate yourself to start a php project in 2021 |
15:31:48 | FromDiscord | <Rika> haha... |
15:31:48 | FromDiscord | <PsychoClay> well i was forced to use php sadly |
15:31:51 | FromDiscord | <Rika> hahahaha.... |
15:31:59 | federico3 | urgh :( |
15:32:01 | FromDiscord | <Rika> yeah hahahahahaha |
15:32:05 | FromDiscord | <PsychoClay> so i thought it would be nice to write it in a different lang |
15:32:17 | FromDiscord | <Rika> really nice to have to work on a php project hahahahahahahaa' |
15:32:30 | FromDiscord | <PsychoClay> and then just transpile to php |
15:32:40 | federico3 | Rika: poor PsychoClay, have some mercy |
15:32:57 | fn | <Prestige99> @Rika I haven't gotten into the js side much but I've heard people have issues interfacing with some dependencies |
15:33:02 | FromDiscord | <Rika> <--- also has to work on a php backend |
15:33:16 | fn | <Prestige99> probably from having to write a bunch of wrappers |
15:33:30 | arkanoid | PsychoClay, please escape from that madness, but in the meantime https://haxe.org/ |
15:33:49 | FromDiscord | <Rika> its a bit different from nim |
15:33:51 | FromDiscord | <Rika> haxe i mean |
15:33:56 | FromDiscord | <PsychoClay> i actually jsut started to use hace for game |
15:34:02 | FromDiscord | <PsychoClay> (edit) "hace" => "haxe" |
15:34:16 | FromDiscord | <PsychoClay> i dont think it compile to php tho right? |
15:34:23 | FromDiscord | <PsychoClay> (edit) "compile" => "compiles" |
15:34:45 | arkanoid | It does since 2016 |
15:35:25 | FromDiscord | <PsychoClay> hmm i might try that then |
15:39:20 | arkanoid | Another wild option would be to compile php stack to LLVM IR via clang, nim to same via nlvm, then bind the two with some thing and produce your binary Frankenstein |
15:41:01 | arkanoid | This might make this mess easier https://www.graalvm.org/ |
15:41:10 | FromDiscord | <PsychoClay> isnt php supposed to be used on a webserver not in binary form? |
15:41:16 | FromDiscord | <Rika> yes |
15:42:03 | arkanoid | Who cares? No browser is going to peek into your backend (hopefully) |
15:42:27 | FromDiscord | <Rika> xss exploiters be like pepega |
15:42:58 | FromDiscord | <haxscramper> https://github.com/nim-lang/Nim/commit/35b0cc67e89a929270e77c07ecbf06f7cced3668 |
15:43:04 | FromDiscord | <haxscramper> we had php backend |
15:43:31 | arkanoid | WHY |
15:44:29 | FromDiscord | <PsychoClay> maybe i should remake it |
15:44:51 | FromDiscord | <haxscramper> it is easy to make simple nim-\>X transpiler |
15:44:52 | FromDiscord | <haxscramper> I made a lua example somewher |
15:45:40 | arkanoid | I want nim to common lisp |
15:45:52 | FromDiscord | <haxscramper> https://github.com/haxscramper/hnimast/blob/ece4676973258330e323fefe15ea81f39ab2ed18/tests/tCompilerAux.nim#L15 |
15:46:11 | FromDiscord | <Rika> arkanoid, why... |
15:46:19 | * | cornfeedhobo joined #nim |
15:46:32 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3ukl |
15:46:38 | FromDiscord | <PsychoClay> wouldnt you need to generate php stdlib nim binding things? |
15:46:39 | FromDiscord | <haxscramper> In reply to @Rika "arkanoid, why...": to not write lisp |
15:46:46 | FromDiscord | <Rika> LMAO i see |
15:46:51 | arkanoid | Because that's the only way to get even more powerful metaprogramming |
15:47:03 | FromDiscord | <haxscramper> In reply to @PsychoClay "wouldnt you need to": yes, I have php parser so |
15:47:34 | FromDiscord | <haxscramper> https://haxscramper.github.io/htsparse/src/htsparse/php/php_wrapper.html#parsePhpString%2Cptr.string%2Cbool |
15:48:04 | FromDiscord | <haxscramper> So you can make PHP -> nim wrapper, php backend |
15:48:46 | arkanoid | That's seriously scary |
15:48:50 | FromDiscord | <haxscramper> I made a java->nim transpiler with this library, implementation is pretty straightforward |
15:49:29 | FromDiscord | <haxscramper> and the fun part is - I did it to rewrite one single project from java to nim |
15:49:38 | FromDiscord | <haxscramper> and I think it was faster this way |
15:49:49 | arkanoid | haxscramper, what's your background, what gives you the confidence to wrap full languages with custom parsers? |
15:50:04 | FromDiscord | <haxscramper> this is a tree-sitter grammar |
15:50:28 | FromDiscord | <haxscramper> but tree-sitter is the best you can get for that sort of thing |
15:50:39 | FromDiscord | <haxscramper> even github uses it for semantic analysis |
15:51:29 | arkanoid | Nobody though me how to deal with grammars back in university :( I should really learn something in that direction. I also want to build my own hammers instead of googling them |
15:52:50 | FromDiscord | <haxscramper> After learning about different parsing algorithms I've come to the conclusion that I'm going to writer recursive descent by hand if needed, and use already existing tools for everything else |
15:53:01 | FromDiscord | <haxscramper> and latter one does not require any specific knowledge |
15:53:23 | FromDiscord | <haxscramper> well, it is preferable to know how GLR works to write tree-sitter grammars, but that's it |
15:53:30 | FromDiscord | <haxscramper> and LR/LALR for bison |
15:53:56 | FromDiscord | <haxscramper> But I haven't added support for bison grammars in htsparse yet, and they are not as good as tree-sitter anyway |
15:54:44 | FromDiscord | <@bracketmaster-5a708063d73408ce4> How do you prefer to do parsing in nim? |
15:55:06 | FromDiscord | <haxscramper> roll recursive descent parser by hand |
15:55:07 | arkanoid | But with tree sitter you mean a generic parsing strategy or this specific project? https://tree-sitter.github.io/tree-sitter/ |
15:55:16 | FromDiscord | <haxscramper> this project |
15:55:37 | FromDiscord | <haxscramper> tree-sitter is just sqlite-tier level of quality project IMO, while bison looks like I would need a whole load of duct tape to make it usable |
15:56:41 | FromDiscord | <haxscramper> roll recursive descent parser by hand ... or more specifically I have recursive descent parser primitives in `hmisc`, and I base things on that |
15:57:42 | arkanoid | Would you suggest an introductory read for this topic? |
15:57:55 | FromDiscord | <haxscramper> recursive descent or tree-sitter? |
15:58:15 | FromDiscord | <Rika> what's wrong with tree-sitter? |
15:58:23 | FromDiscord | <haxscramper> nothing? |
15:58:42 | FromDiscord | <haxscramper> well, generating parser code is a pain in the as |
15:58:43 | FromDiscord | <haxscramper> ass |
15:58:48 | FromDiscord | <haxscramper> since it depends on npm |
15:58:48 | arkanoid | If I start with "parsers" I end up in MIT courseware and then though the rabbit hole till the death of the universe |
15:58:55 | FromDiscord | <Rika> oh i assumed "xxx-tier level" was negative |
15:59:30 | FromDiscord | <haxscramper> well, I used `xxx = sqlite`, and I don't think anyone would use it a negative example. But anyway |
15:59:34 | FromDiscord | <haxscramper> I learned RD mostly by example, with some theoretical background like dragon book |
15:59:37 | FromDiscord | <haxscramper> https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6#examples |
15:59:50 | FromDiscord | <haxscramper> Most of the languages written in nim use recrusive descent parsers |
16:00:12 | arkanoid | Do you have any idea where sqlite is installed? Sqlite is at the root of EVERYTHING nowadays |
16:01:13 | FromDiscord | <haxscramper> I wrote seveal project that involved parsers in one form or another, but right now I don't think I would want to put them on display as an example, so if you want a recommendation as to what projects can be used as referece |
16:01:15 | FromDiscord | <Rika> being used everywhere doesnt mean its good, i mean, look at php |
16:01:30 | FromDiscord | <haxscramper> You can see something by lqdev |
16:02:08 | FromDiscord | <haxscramper> of well https://github.com/liquidev/tsuki/commit/27c04d63216783126aeb9627121c4bf4aa5f44c5 |
16:02:21 | FromDiscord | <haxscramper> things are getting rusty there |
16:02:31 | FromDiscord | <rishavs (Rishav Sharan)> I just added the nim stdlib http server in the techempower benchmark.↵https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Nim/nim-stdlib↵As none of the nim frameworks have full suite done, my main motivation was to have at least one nim framework which has end to end tests |
16:02:42 | fn | <ForumUpdaterBot99> New thread by Rishavs: Techempower entry for nim stdlib http server, see https://forum.nim-lang.org/t/8280 |
16:02:52 | arkanoid | Thanks haxscramper |
16:03:29 | FromDiscord | <haxscramper> I personally spend too much time theorizing and reading about different parser algorithms |
16:03:48 | FromDiscord | <haxscramper> but with RD you can just start coding and learn by mistakes |
16:04:19 | FromDiscord | <haxscramper> I suppose. At least RD parsers tend to be pretty straightforward in terms of code, and you can kind of figure out that your implementation is bad |
16:04:28 | * | stkrdknmibalz joined #nim |
16:04:28 | FromDiscord | <haxscramper> using the same approach as any regilar code |
16:04:55 | arkanoid | I am googling "recursive descend", just to let you know my level of knowledge on the topic. But I've also started writing Haskell so the word " recursive" is much more familiar now |
16:07:29 | FromDiscord | <Split Toe Derby> is there a library to "tcpdump" and filter certain received packets in realtime ? |
16:08:54 | arkanoid | libpcap |
16:16:18 | FromDiscord | <haxscramper> https://wandbox.org/permlink/62xIk9LT2cJmHIi9 |
16:16:50 | FromDiscord | <haxscramper> RD is just a collection of simple patterns like "parse token", "parse A+", "parse A?" |
16:20:57 | arkanoid | Seems like how I would write it. It still smells like a chain of "if" or "case" |
16:21:59 | FromDiscord | <Split Toe Derby> thanks arkanoid |
16:22:05 | arkanoid | Np |
16:22:26 | * | Freneticks quit (Ping timeout: 256 seconds) |
16:23:35 | FromDiscord | <haxscramper> if you think there is some hidden complexity in RD that you just don't see - there is not. It really is just a lot of case/if/while loops |
16:23:36 | FromDiscord | <haxscramper> https://github.com/nim-lang/Nim/blob/devel/compiler/parser.nim#L2218 |
16:24:14 | FromDiscord | <haxscramper> You need to embed pratt/shunting-yard parser for expressions, but it is a separate topic |
16:28:16 | arkanoid | It feels like "go functional is all about chaining pure functions!" and then you end up in category theory and even more higher typed kinds and you go meh |
16:29:15 | FromDiscord | <konsumlamm> you can perfectly fine learn/use FP withput ever learning about category theory |
16:29:25 | FromDiscord | <konsumlamm> (edit) "withput" => "without" |
16:36:07 | arkanoid | Sure, I was not complaining. Parsing is a complex matter and I do really think that learning how a parser is made can help me identify better the tokens in every programming language and paradigm |
17:09:02 | * | Freneticks joined #nim |
17:33:40 | FromDiscord | <codic> i'm curious, why do people use a header pragma next to importc? why do you need the header if the prototype is right there? |
17:39:18 | FromDiscord | <woodgiraffe (woodgiraffe)> hi, can someone point me towards how to use seq's from C, like iterate over them, free them etc. - I'm using `--gc:arc` |
17:40:35 | FromDiscord | <dom96> In reply to @rishavs (Rishav Sharan) "I just added the": that's cool but I fear will just make Nim seem slow :/ |
17:42:56 | FromDiscord | <dom96> yep, you're using db_postgres which isn't async |
17:46:49 | FromDiscord | <haxscramper> In reply to @codic "i'm curious, why do": It is mandatory in order for compiler to `#include` things correctly |
17:50:11 | FromDiscord | <codic> why does it need to #include anything at all |
17:50:24 | FromDiscord | <codic> we give the compiler the prototype, it spits out the equivalent C prototype |
17:50:32 | FromDiscord | <codic> header files are just lists of function prototypes |
17:54:29 | FromDiscord | <leorize> because there's a "hack" that Nim uses to wrap things faster, it's to use the definition in the headers themselves as not all of the prototypes can be replicated in Nim |
17:54:38 | FromDiscord | <haxscramper> In reply to @woodgiraffe (woodgiraffe) "hi, can someone point": https://wandbox.org/permlink/B60BTPAUIHn5Q5Cs |
17:54:56 | FromDiscord | <PsychoClay> is starting a thread from another not a thing you can do in nim? |
17:55:14 | FromDiscord | <haxscramper> freeing sequence etc. is probably done via some GC hackery, idk what exactly is needed |
17:55:41 | FromDiscord | <haxscramper> In reply to @codic "header files are just": because C function prototype does not exist in a vacuum |
17:55:53 | FromDiscord | <haxscramper> there are types, additional deps |
17:56:02 | FromDiscord | <haxscramper> If you don't need header then use `dynlib` |
17:56:26 | FromDiscord | <haxscramper> https://github.com/nimterop/nimterop#header-vs-dynlib |
17:56:29 | fn | <R2D299> itHub: 7"Nimterop is a Nim package that aims to make C/C++ interop seamless" |
17:56:47 | FromDiscord | <haxscramper> no the package itself, but the explanation in the readme |
17:57:57 | FromDiscord | <haxscramper> (edit) "no" => "not" |
17:58:23 | FromDiscord | <leorize> if you use `arc` then freeing seq is just `eqdestroy` |
18:00:24 | FromDiscord | <haxscramper> And if I want to construct a sequence from the C? I just need to use something like `typedef struct NimSeq { int cap, len; void payload; } NimSeq;` and `malloc`/cast it around? |
18:06:27 | FromDiscord | <codic> sent a long message, see http://ix.io/3ul0 |
18:06:52 | FromDiscord | <haxscramper> If you dont' want header or dynlib then you don't need to importc as well |
18:06:55 | FromDiscord | <haxscramper> you need to exportc |
18:07:20 | FromDiscord | <haxscramper> you declare procedure prototype, nim will generate it as you wrote |
18:07:25 | FromDiscord | <haxscramper> and linker will figure it out |
18:07:45 | FromDiscord | <codic> oh ok |
18:08:07 | FromDiscord | <haxscramper> though this does not work |
18:08:15 | FromDiscord | <haxscramper> but the idea is somewhere along these lines |
18:08:27 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3ul1 |
18:08:50 | FromDiscord | <haxscramper> make nim generate function declaration in C, then hope linker will do it's job |
18:09:22 | FromDiscord | <haxscramper> `proc seq_ops(seqData: pointer, len: cint) {.exportc, nodecl.} = discard` |
18:09:30 | FromDiscord | <haxscramper> https://wandbox.org/permlink/gfQkyktECy9iOdE2 I reused the same example from above |
18:09:42 | FromDiscord | <haxscramper> But I think now it does what you expect it to |
18:09:58 | FromDiscord | <leorize> export newSeq to C then use it |
18:10:17 | FromDiscord | <leorize> using malloc is dangerous since it's not the same as Nim's allocator |
18:10:26 | FromDiscord | <haxscramper> But `newSeq` is a generic procedure (https://nim-lang.org/docs/system.html#newSeq%2Cseq%5BT%5D%2CNatural), so I would have to explicitly instantiate it for all overloads? |
18:10:26 | FromDiscord | <leorize> to be perfectly safe just call out to Nim to get an initialized seq |
18:10:34 | FromDiscord | <leorize> yes |
18:11:13 | FromDiscord | <leorize> C is low-level and you ought to give up some data, unfortunately |
18:11:19 | FromDiscord | <leorize> though there might be a way for you |
18:11:51 | FromDiscord | <leorize> actually there aren't any \:P Nim infers these info at Nim's compile-time |
18:12:13 | FromDiscord | <codic> `proc abc(foo: cint): void {.exportc, .nodecl.}` like this to import an `abc` proc from C then?? |
18:12:46 | FromDiscord | <leorize> no, use `proc abc(foo: cint) {.importc, cdecl.}` |
18:12:57 | FromDiscord | <haxscramper> Maybe just write horrible C macro that models after https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L1376 |
18:13:23 | FromDiscord | <leorize> depending on Nim's internal data structures is never a good idea |
18:13:39 | FromDiscord | <leorize> one `--gc:` switch and you're dealing with a different data structure |
18:13:48 | FromDiscord | <codic> (edit) "then??" => "then?" |
18:14:18 | FromDiscord | <codic> so I can use importc there without a header ,that was my question, got it |
18:30:55 | FromDiscord | <planetis> One think I am trying to prevent is outofmem defect when trying to allocate a huge buffer. Anyone else ever dealt with it? |
18:37:55 | FromDiscord | <planetis> oh i actually have an idea |
18:39:40 | FromDiscord | <jfmonty2> Do strings have a lot of memory overhead? I tried defining a `const seq[string]` of 130k strings in my executable and it ballooned to over 12MB (source data file was only 1.2MB or so.) Switched to just a single `const string` that was parsed at runtime and the executable size dropped right down to <2MB. |
18:40:21 | FromDiscord | <jfmonty2> I can see that every string would involve a pointer and a len, which would be 16 bytes before you even get to the char data, but that's still only about 3.2MB total. |
18:44:39 | FromDiscord | <woodgiraffe (woodgiraffe)> > https://wandbox.org/permlink/gfQkyktECy9iOdE2 I reused the same example from above↵oh that's very nice, thank you for that |
19:22:02 | * | rockcavera quit (Read error: Connection reset by peer) |
19:22:28 | * | rockcavera joined #nim |
19:22:28 | * | rockcavera quit (Changing host) |
19:22:28 | * | rockcavera joined #nim |
19:24:54 | * | neceve quit (Ping timeout: 256 seconds) |
19:38:50 | FromDiscord | <planetis> could it be you are using seq.add and it creates bigger seqs than necessary↵(@jfmonty2) |
19:39:19 | FromDiscord | <jfmonty2> It's only one seq though, so at the very most it would be what, 2x the required size? Not 10x |
19:39:54 | FromDiscord | <jfmonty2> Although I guess a string is basically a seq, and maybe `splitLines` uses `add` internally on them |
19:40:26 | FromDiscord | <jfmonty2> I don't know the resizing logic for strings/seqs, how much bigger than necessary can they be? |
19:48:23 | FromDiscord | <planetis> see lib/system/seqsv2 strsv2.nim |
19:48:52 | FromDiscord | <planetis> len plus 2/3 for seqs if i remember |
19:50:09 | FromDiscord | <planetis> take a look at the generated c you will figure it out |
19:50:53 | FromDiscord | <arnetheduck> In reply to @codic "i'm curious, why do": for the wrappers we write, we strive to avoid unnecessary noise like this - `header` is a bit of an anti-feature when you have an accurate ABI description of the type |
19:56:29 | * | supakeen quit (Remote host closed the connection) |
19:56:53 | * | supakeen joined #nim |
20:07:51 | * | Trustable joined #nim |
20:08:05 | * | Trustable quit (Client Quit) |
20:20:05 | FromDiscord | <codic> 👍 |
20:29:38 | fn | <ForumUpdaterBot99> New thread by Tsojtsoj: Nimscript produces slower executable, see https://forum.nim-lang.org/t/8281 |
21:07:47 | * | thunder quit (Remote host closed the connection) |
21:08:11 | * | thunder joined #nim |
21:31:15 | FromDiscord | <RattleyCooper> I have a `proc regRpc(s: string, p: proc())` procedure that updates a `Table[string, proc()]`. How might I turn that into a pragma so I can add to my proc declarations ie `proc some_proc() {.regRpc("some_string").} =`? |
21:31:51 | FromDiscord | <RattleyCooper> (edit) "I have a `proc regRpc(s: string, p: proc())` procedure that updates a `Table[string, proc()]`. How might I turn that into a pragma so I can add to my proc declarations ie `proc some_proc() {.regRpc("some_string").} =`? ... " added " I feel like that would be cleaner than listing out a bunch of `regRpc` procedure calls." |
21:32:19 | * | max22- quit (Remote host closed the connection) |
21:32:33 | FromDiscord | <RattleyCooper> I looked at the docs about custom pragmas but I'm having trouble applying the docs to my scenario |
21:32:36 | * | max22- joined #nim |
22:01:07 | FromDiscord | <@bracketmaster-5a708063d73408ce4> has anyone ever compared nim vs swift? |
22:01:12 | FromDiscord | <@bracketmaster-5a708063d73408ce4> swift can do DSL too apparently |
22:01:21 | FromDiscord | <@bracketmaster-5a708063d73408ce4> and Swift also has ARC |
22:19:14 | FromDiscord | <Hi02Hi> In reply to @@bracketmaster-5a708063d73408ce4 "and Swift also has": different to nim's arc |
22:19:24 | FromDiscord | <Hi02Hi> (edit) "to" => "from" |
22:24:47 | FromDiscord | <treeform> Nearly every language can do DSL, its just "how well" can it do it. |
22:26:39 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Swift seems to have been designed with DSLs in mind |
22:26:58 | * | thunder quit (Ping timeout: 240 seconds) |
22:32:37 | * | thunder joined #nim |
22:33:48 | * | rockcavera quit (Ping timeout: 268 seconds) |
22:35:11 | * | rockcavera joined #nim |
22:35:11 | * | rockcavera quit (Changing host) |
22:35:11 | * | rockcavera joined #nim |
22:45:52 | * | max22- quit (Remote host closed the connection) |
22:53:03 | FromDiscord | <SirJosh> yo i was looking at that blog post - does anyone have the haskell example on hand? i'm amazed that haskell can seemingly get that fast <https://nim-lang.org/blog/2021/07/28/Nim-Efficient-Expressive-Elegant-Benchmarking.html> |
22:53:09 | FromDiscord | <SirJosh> (edit) "that" => "the most recent" |