<< 28-07-2021 >>

00:50:49FromDiscord<Alea> why does --app:gui link a whole ton of win32 libs?
00:51:02FromDiscord<Alea> I just want to hide the cmd prompt that pops up
00:53:55FromDiscord<Alea> er actually it happens sometimes even without that option
00:54:46FromDiscord<Alea> sent a code paste, see https://play.nim-lang.org/#ix=3ugy
01:01:42FromDiscord<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:33FromDiscord<ElegantBeef> The zips you can download should have the dlls you can plop down
01:04:55FromDiscord<juan_carlos> If is just learning probably wont need Testament just yet... :p
01:09:31FromDiscord<reilly> In reply to @ElegantBeef "The zips you can": In what folder, though?
01:10:06FromDiscord<Elegantbeef> Next to the nimble binary i'd imagine
01:31:47FromDiscord<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:03FromDiscord<reilly> https://media.discordapp.net/attachments/371759389889003532/869755551255523398/libs.zip
01:39:59FromDiscord<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:29FromDiscord<generic linux user> 🙂.
02:20:53*arkurious quit (Quit: Leaving)
02:40:21FromDiscord<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:23FromDiscord<saem> Then that's recoverable, crashing out a users program isn't a great library decision. Basically always a bad idea.
05:08:48FromDiscord<bolino> Hello! Do you know how to transform a JsonNode into a string?
05:09:28FromDiscord<Rika> $
05:09:32FromDiscord<bolino> I tried `.getStr()` but it return an empty string.
05:09:32FromDiscord<Elegantbeef> you can do `$` or `pretty`
05:09:47FromDiscord<Rika> One is uglified the other is self explanatory
05:10:01FromDiscord<Rika> Pick your poison
05:10:17FromDiscord<bolino> Oh, OK! Stupid me. Thanks a lot.
05:12:21FromDiscord<Rika> Honestly though I think .string should work similarly to $
05:12:40FromDiscord<Rika> Hmm
05:13:14FromDiscord<Rika> It would be inconsistent with what Nim does with other types though I guess
05:37:04FromDiscord<reilly> Does anyone know how to handle collision (Area2D, CollisionShape2D) in Godot-Nim?
05:40:02FromDiscord<Rika> Might be more appropriate for #gamedev
06:20:29*neceve joined #nim
06:43:18*Kostrak joined #nim
06:49:10FromDiscord<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:56FromDiscord<planetis> unless it is awaken somehow
06:51:56FromDiscord<planetis> I am not sure thats why i am asking here, in case someone knows
06:54:02FromDiscord<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:59FromDiscord<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:07fn<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:44FromDiscord<@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:14FromDiscord<generic linux user> its not that hard to build though
10:31:42FromDiscord<generic linux user> and, you shall download the latest rpm from opensuse and use alien to convert it to deb and install
10:34:42FromDiscord<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:44FromDiscord<@hjarausch_gitlab-5fa43a7bd73408> Thanks, but Nim on OpenSuse is even older (1.2)
10:46:05*pro quit (Quit: WeeChat 3.2)
10:50:18FromDiscord<generic linux user> then fedora
10:50:27FromDiscord<generic linux user> and also nightlies
10:51:24FromDiscord<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:51FromDiscord<gerwy> does anyone know something similar to this https://github.com/gobuffalo/packr↵but made for nim?
11:45:18FromDiscord<gerwy> what i need is to include assets inside of the binary
11:45:30FromDiscord<gerwy> to have single exec with all the stuff inside
11:50:00FromDiscord<Rika> xmonader/nimassets
11:50:38FromDiscord<Rika> or just `const xxx = staticread("thefilename")` i guess would work too?
11:50:56FromDiscord<gerwy> In reply to @Rika "xmonader/nimassets": :OO
11:51:24FromDiscord<gerwy> the first one is cool
11:51:42FromDiscord<gerwy> i will try other one too i didn't know about that function thaaaanks
11:52:07FromDiscord<gerwy> there is idea for a game jam so i look for solutions already to not waste time hah
11:52:27FromDiscord<Rika> do game jams have limits other than time?
11:52:41FromDiscord<Rika> i remember some sort of game jam that had filesize limits, i forgot the name
11:52:48FromDiscord<Rika> one was 4kb and another was 1kb afaik
11:52:51FromDiscord<Rika> dont remember
11:54:02FromDiscord<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:38FromDiscord<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:31FromDiscord<gerwy> there is already a lot of ideas, one of the best i think is 1MB game jam
11:55:53FromDiscord<gerwy> but also 256KB game and only a single executable
11:57:36FromDiscord<Rika> 256kb sounds fun
11:57:51FromDiscord<enthus1ast> tja
11:57:56FromDiscord<Rika> tja?
11:58:09FromDiscord<gerwy> ye
11:58:29FromDiscord<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:06FromDiscord<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:34FromDiscord<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:34FromDiscord<Rika> some games do away with such a thing and its ok
12:00:46FromDiscord<Rika> imo i would rather no bgm over a very repetitive one
12:01:05FromDiscord<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:47FromDiscord<Rika> music cant easily be generated that way
12:19:07FromDiscord<gerwy> well thats your problem then, the size wouldn't be the limit then
12:26:47federico3@hjarausch_gitlab-5fa43a7bd73408 an updated package is in the Debian Experimental archive
12:27:44federico3(1.4.8)
12:31:10FromDiscord<generic linux user> experimental!!
12:31:20federico3what?
12:39:14*pro joined #nim
12:53:39FromDiscord<@hjarausch_gitlab-5fa43a7bd73408> @\_discord\_709044657232936960\_federico3 From my stable Debian release (Bullseye) it's not possible to use
12:54:32FromDiscord<@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:31federico3Bullseye is not released yet. Once it is released I'll backport 1.4.8 to it
12:56:25*Freneticks joined #nim
12:57:07federico3besides, I just tried installing it from experimental and it worked
12:58:25federico3you 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:12Freneticksi'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:19FromDiscord<generic linux user> whyy backport
13:03:51FromDiscord<@hjarausch_gitlab-5fa43a7bd73408> Many thanks to frederico3
13:14:00FromDiscord<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:19FromDiscord<SolitudeSF> error indicates that nim cant find the module
13:18:46Freneticksit 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:47FromDiscord<vindaar> ah, you're right. sorry on the phone and didn't read properly 🤦‍♂️
13:28:27FromDiscord<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:11Freneticksvindaar working sdl2 but the wraper i use is not found -> sdl2_nim
13:41:08FreneticksI 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:39FromDiscord<vindaar> but nimble install seems like it's working correctly?
13:46:26Freneticksyeah
13:47:19FromDiscord<vindaar> maybe there's some weirdness with the name of the package?
13:48:58Freneticksprobably 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:02FromDiscord<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:08FromDiscord<vindaar> eg here https://github.com/Vladar4/sdl2_nim/blob/master/examples/ex101_init.nim
13:53:04FromDiscord<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:22Freneticksi have the same error with sdl2nim and yeah i already tried to compile the example
14:31:27Freneticksbut i have the not found error
14:34:19*max22- quit (Remote host closed the connection)
14:34:38*max22- joined #nim
14:38:32fn<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:31FromDiscord<enthus1ast> Wrong channel 😁↵(@Rika)
14:53:52FromDiscord<Rika> ah i see
14:57:25FromDiscord<lamersc.com 🐧> Could someone explain what a cycle collector is?
14:57:45FromDiscord<konsumlamm> it collects reference cycles
14:57:50FromDiscord<lamersc.com 🐧> I’ve seen people saying orc has it, but don’t fully understand what it is
14:57:56FromDiscord<Rika> whats the part that you dont understand
14:58:05*max22- quit (Ping timeout: 268 seconds)
14:58:58FromDiscord<lamersc.com 🐧> What exactly is a reference cycle 😅
14:59:33*max22- joined #nim
14:59:40FromDiscord<lamersc.com 🐧> Probably sound like an idiot, but just trying to make more sense of it
15:00:43FromDiscord<konsumlamm> if object A refers to object B and object B refers to A
15:01:05FromDiscord<Rika> In reply to @lamersc.com 🐧 "Probably sound like an": we all sound like idiots to at least someone in this world
15:01:12FromDiscord<konsumlamm> reference counting won't collect them, since the refcount of each object is at least 1
15:01:37FromDiscord<konsumlamm> so if noone else has a reference to A or B, it could be collected
15:01:44FromDiscord<konsumlamm> which is the job of the cycle collector
15:02:16FromDiscord<lamersc.com 🐧> Okay, that makes much more sense now
15:02:50FromDiscord<Rika> the catch with orc is that it makes it "nondeterministic" meaning that it's "unpredictable" in a way
15:02:58FromDiscord<Rika> because of the cycle collector
15:03:44FromDiscord<lamersc.com 🐧> That’s much more clear now 😅 I got so confused with it when originally reading on the docs
15:03:44FromDiscord<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:05FromDiscord<Rika> which is why there's both arc and orc
15:04:17FromDiscord<lamersc.com 🐧> It’d be a better bet to use orc for something, say an HTTP server in that sense then
15:04:21FromDiscord<Rika> yes
15:04:30FromDiscord<lamersc.com 🐧> And arc in an embedded/OS environment?
15:04:33FromDiscord<Rika> yes
15:04:47FromDiscord<Rika> or audio processing
15:05:13FromDiscord<lamersc.com 🐧> Thanks for clearing things up for me 😅 I was searching around, but couldn’t find much straight forward answers
15:05:23FromDiscord<Rika> well, i guess audio processing is soft realtime (something happening late degrades the system but it does not fail)
15:05:49federico3or just ARC
15:06:54FromDiscord<lamersc.com 🐧> @Rika @konsumlamm thank for your explaining 😄
15:27:23arkanoidJust out of curiosity, which backend would you add to nim and why?
15:28:36fn<Prestige99> As in, a _new_ backend?
15:29:02FromDiscord<Rika> i wouldnt, if i had the resources to add a backend i would fix bugs with it instead
15:29:17fn<Prestige99> ^ agreed
15:29:28FromDiscord<PsychoClay> php maybe
15:29:31fn<Prestige99> or maybe build out better js support
15:29:47FromDiscord<Rika> better js support could be nice but i cant see much issues with it now
15:29:52FromDiscord<Rika> In reply to @PsychoClay "php maybe": well why?
15:30:13FromDiscord<PsychoClay> because i dont like php syntax
15:30:17FromDiscord<PsychoClay> and prefer nim's
15:30:25arkanoidWhy don't improve llvm support and then go from llvm to web via emscripten?
15:30:29FromDiscord<Rika> i mean you could jsut write to C...
15:30:46FromDiscord<Rika> php is a server language though
15:31:17arkanoidYou should really hate yourself to start a php project in 2021
15:31:48FromDiscord<Rika> haha...
15:31:48FromDiscord<PsychoClay> well i was forced to use php sadly
15:31:51FromDiscord<Rika> hahahaha....
15:31:59federico3urgh :(
15:32:01FromDiscord<Rika> yeah hahahahahaha
15:32:05FromDiscord<PsychoClay> so i thought it would be nice to write it in a different lang
15:32:17FromDiscord<Rika> really nice to have to work on a php project hahahahahahahaa'
15:32:30FromDiscord<PsychoClay> and then just transpile to php
15:32:40federico3Rika: poor PsychoClay, have some mercy
15:32:57fn<Prestige99> @Rika I haven't gotten into the js side much but I've heard people have issues interfacing with some dependencies
15:33:02FromDiscord<Rika> <--- also has to work on a php backend
15:33:16fn<Prestige99> probably from having to write a bunch of wrappers
15:33:30arkanoidPsychoClay, please escape from that madness, but in the meantime https://haxe.org/
15:33:49FromDiscord<Rika> its a bit different from nim
15:33:51FromDiscord<Rika> haxe i mean
15:33:56FromDiscord<PsychoClay> i actually jsut started to use hace for game
15:34:02FromDiscord<PsychoClay> (edit) "hace" => "haxe"
15:34:16FromDiscord<PsychoClay> i dont think it compile to php tho right?
15:34:23FromDiscord<PsychoClay> (edit) "compile" => "compiles"
15:34:45arkanoidIt does since 2016
15:35:25FromDiscord<PsychoClay> hmm i might try that then
15:39:20arkanoidAnother 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:01arkanoidThis might make this mess easier https://www.graalvm.org/
15:41:10FromDiscord<PsychoClay> isnt php supposed to be used on a webserver not in binary form?
15:41:16FromDiscord<Rika> yes
15:42:03arkanoidWho cares? No browser is going to peek into your backend (hopefully)
15:42:27FromDiscord<Rika> xss exploiters be like pepega
15:42:58FromDiscord<haxscramper> https://github.com/nim-lang/Nim/commit/35b0cc67e89a929270e77c07ecbf06f7cced3668
15:43:04FromDiscord<haxscramper> we had php backend
15:43:31arkanoidWHY
15:44:29FromDiscord<PsychoClay> maybe i should remake it
15:44:51FromDiscord<haxscramper> it is easy to make simple nim-\>X transpiler
15:44:52FromDiscord<haxscramper> I made a lua example somewher
15:45:40arkanoidI want nim to common lisp
15:45:52FromDiscord<haxscramper> https://github.com/haxscramper/hnimast/blob/ece4676973258330e323fefe15ea81f39ab2ed18/tests/tCompilerAux.nim#L15
15:46:11FromDiscord<Rika> arkanoid, why...
15:46:19*cornfeedhobo joined #nim
15:46:32FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3ukl
15:46:38FromDiscord<PsychoClay> wouldnt you need to generate php stdlib nim binding things?
15:46:39FromDiscord<haxscramper> In reply to @Rika "arkanoid, why...": to not write lisp
15:46:46FromDiscord<Rika> LMAO i see
15:46:51arkanoidBecause that's the only way to get even more powerful metaprogramming
15:47:03FromDiscord<haxscramper> In reply to @PsychoClay "wouldnt you need to": yes, I have php parser so
15:47:34FromDiscord<haxscramper> https://haxscramper.github.io/htsparse/src/htsparse/php/php_wrapper.html#parsePhpString%2Cptr.string%2Cbool
15:48:04FromDiscord<haxscramper> So you can make PHP -> nim wrapper, php backend
15:48:46arkanoidThat's seriously scary
15:48:50FromDiscord<haxscramper> I made a java->nim transpiler with this library, implementation is pretty straightforward
15:49:29FromDiscord<haxscramper> and the fun part is - I did it to rewrite one single project from java to nim
15:49:38FromDiscord<haxscramper> and I think it was faster this way
15:49:49arkanoidhaxscramper, what's your background, what gives you the confidence to wrap full languages with custom parsers?
15:50:04FromDiscord<haxscramper> this is a tree-sitter grammar
15:50:28FromDiscord<haxscramper> but tree-sitter is the best you can get for that sort of thing
15:50:39FromDiscord<haxscramper> even github uses it for semantic analysis
15:51:29arkanoidNobody 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:50FromDiscord<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:01FromDiscord<haxscramper> and latter one does not require any specific knowledge
15:53:23FromDiscord<haxscramper> well, it is preferable to know how GLR works to write tree-sitter grammars, but that's it
15:53:30FromDiscord<haxscramper> and LR/LALR for bison
15:53:56FromDiscord<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:44FromDiscord<@bracketmaster-5a708063d73408ce4> How do you prefer to do parsing in nim?
15:55:06FromDiscord<haxscramper> roll recursive descent parser by hand
15:55:07arkanoidBut with tree sitter you mean a generic parsing strategy or this specific project? https://tree-sitter.github.io/tree-sitter/
15:55:16FromDiscord<haxscramper> this project
15:55:37FromDiscord<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:41FromDiscord<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:42arkanoidWould you suggest an introductory read for this topic?
15:57:55FromDiscord<haxscramper> recursive descent or tree-sitter?
15:58:15FromDiscord<Rika> what's wrong with tree-sitter?
15:58:23FromDiscord<haxscramper> nothing?
15:58:42FromDiscord<haxscramper> well, generating parser code is a pain in the as
15:58:43FromDiscord<haxscramper> ass
15:58:48FromDiscord<haxscramper> since it depends on npm
15:58:48arkanoidIf I start with "parsers" I end up in MIT courseware and then though the rabbit hole till the death of the universe
15:58:55FromDiscord<Rika> oh i assumed "xxx-tier level" was negative
15:59:30FromDiscord<haxscramper> well, I used `xxx = sqlite`, and I don't think anyone would use it a negative example. But anyway
15:59:34FromDiscord<haxscramper> I learned RD mostly by example, with some theoretical background like dragon book
15:59:37FromDiscord<haxscramper> https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6#examples
15:59:50FromDiscord<haxscramper> Most of the languages written in nim use recrusive descent parsers
16:00:12arkanoidDo you have any idea where sqlite is installed? Sqlite is at the root of EVERYTHING nowadays
16:01:13FromDiscord<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:15FromDiscord<Rika> being used everywhere doesnt mean its good, i mean, look at php
16:01:30FromDiscord<haxscramper> You can see something by lqdev
16:02:08FromDiscord<haxscramper> of well https://github.com/liquidev/tsuki/commit/27c04d63216783126aeb9627121c4bf4aa5f44c5
16:02:21FromDiscord<haxscramper> things are getting rusty there
16:02:31FromDiscord<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:42fn<ForumUpdaterBot99> New thread by Rishavs: Techempower entry for nim stdlib http server, see https://forum.nim-lang.org/t/8280
16:02:52arkanoidThanks haxscramper
16:03:29FromDiscord<haxscramper> I personally spend too much time theorizing and reading about different parser algorithms
16:03:48FromDiscord<haxscramper> but with RD you can just start coding and learn by mistakes
16:04:19FromDiscord<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:28FromDiscord<haxscramper> using the same approach as any regilar code
16:04:55arkanoidI 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:29FromDiscord<Split Toe Derby> is there a library to "tcpdump" and filter certain received packets in realtime ?
16:08:54arkanoidlibpcap
16:16:18FromDiscord<haxscramper> https://wandbox.org/permlink/62xIk9LT2cJmHIi9
16:16:50FromDiscord<haxscramper> RD is just a collection of simple patterns like "parse token", "parse A+", "parse A?"
16:20:57arkanoidSeems like how I would write it. It still smells like a chain of "if" or "case"
16:21:59FromDiscord<Split Toe Derby> thanks arkanoid
16:22:05arkanoidNp
16:22:26*Freneticks quit (Ping timeout: 256 seconds)
16:23:35FromDiscord<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:36FromDiscord<haxscramper> https://github.com/nim-lang/Nim/blob/devel/compiler/parser.nim#L2218
16:24:14FromDiscord<haxscramper> You need to embed pratt/shunting-yard parser for expressions, but it is a separate topic
16:28:16arkanoidIt 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:15FromDiscord<konsumlamm> you can perfectly fine learn/use FP withput ever learning about category theory
16:29:25FromDiscord<konsumlamm> (edit) "withput" => "without"
16:36:07arkanoidSure, 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:40FromDiscord<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:18FromDiscord<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:35FromDiscord<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:56FromDiscord<dom96> yep, you're using db_postgres which isn't async
17:46:49FromDiscord<haxscramper> In reply to @codic "i'm curious, why do": It is mandatory in order for compiler to `#include` things correctly
17:50:11FromDiscord<codic> why does it need to #include anything at all
17:50:24FromDiscord<codic> we give the compiler the prototype, it spits out the equivalent C prototype
17:50:32FromDiscord<codic> header files are just lists of function prototypes
17:54:29FromDiscord<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:38FromDiscord<haxscramper> In reply to @woodgiraffe (woodgiraffe) "hi, can someone point": https://wandbox.org/permlink/B60BTPAUIHn5Q5Cs
17:54:56FromDiscord<PsychoClay> is starting a thread from another not a thing you can do in nim?
17:55:14FromDiscord<haxscramper> freeing sequence etc. is probably done via some GC hackery, idk what exactly is needed
17:55:41FromDiscord<haxscramper> In reply to @codic "header files are just": because C function prototype does not exist in a vacuum
17:55:53FromDiscord<haxscramper> there are types, additional deps
17:56:02FromDiscord<haxscramper> If you don't need header then use `dynlib`
17:56:26FromDiscord<haxscramper> https://github.com/nimterop/nimterop#header-vs-dynlib
17:56:29fn<R2D299> itHub: 7"Nimterop is a Nim package that aims to make C/C++ interop seamless"
17:56:47FromDiscord<haxscramper> no the package itself, but the explanation in the readme
17:57:57FromDiscord<haxscramper> (edit) "no" => "not"
17:58:23FromDiscord<leorize> if you use `arc` then freeing seq is just `eqdestroy`
18:00:24FromDiscord<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:27FromDiscord<codic> sent a long message, see http://ix.io/3ul0
18:06:52FromDiscord<haxscramper> If you dont' want header or dynlib then you don't need to importc as well
18:06:55FromDiscord<haxscramper> you need to exportc
18:07:20FromDiscord<haxscramper> you declare procedure prototype, nim will generate it as you wrote
18:07:25FromDiscord<haxscramper> and linker will figure it out
18:07:45FromDiscord<codic> oh ok
18:08:07FromDiscord<haxscramper> though this does not work
18:08:15FromDiscord<haxscramper> but the idea is somewhere along these lines
18:08:27FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3ul1
18:08:50FromDiscord<haxscramper> make nim generate function declaration in C, then hope linker will do it's job
18:09:22FromDiscord<haxscramper> `proc seq_ops(seqData: pointer, len: cint) {.exportc, nodecl.} = discard`
18:09:30FromDiscord<haxscramper> https://wandbox.org/permlink/gfQkyktECy9iOdE2 I reused the same example from above
18:09:42FromDiscord<haxscramper> But I think now it does what you expect it to
18:09:58FromDiscord<leorize> export newSeq to C then use it
18:10:17FromDiscord<leorize> using malloc is dangerous since it's not the same as Nim's allocator
18:10:26FromDiscord<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:26FromDiscord<leorize> to be perfectly safe just call out to Nim to get an initialized seq
18:10:34FromDiscord<leorize> yes
18:11:13FromDiscord<leorize> C is low-level and you ought to give up some data, unfortunately
18:11:19FromDiscord<leorize> though there might be a way for you
18:11:51FromDiscord<leorize> actually there aren't any \:P Nim infers these info at Nim's compile-time
18:12:13FromDiscord<codic> `proc abc(foo: cint): void {.exportc, .nodecl.}` like this to import an `abc` proc from C then??
18:12:46FromDiscord<leorize> no, use `proc abc(foo: cint) {.importc, cdecl.}`
18:12:57FromDiscord<haxscramper> Maybe just write horrible C macro that models after https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L1376
18:13:23FromDiscord<leorize> depending on Nim's internal data structures is never a good idea
18:13:39FromDiscord<leorize> one `--gc:` switch and you're dealing with a different data structure
18:13:48FromDiscord<codic> (edit) "then??" => "then?"
18:14:18FromDiscord<codic> so I can use importc there without a header ,that was my question, got it
18:30:55FromDiscord<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:55FromDiscord<planetis> oh i actually have an idea
18:39:40FromDiscord<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:21FromDiscord<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:39FromDiscord<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:50FromDiscord<planetis> could it be you are using seq.add and it creates bigger seqs than necessary↵(@jfmonty2)
19:39:19FromDiscord<jfmonty2> It's only one seq though, so at the very most it would be what, 2x the required size? Not 10x
19:39:54FromDiscord<jfmonty2> Although I guess a string is basically a seq, and maybe `splitLines` uses `add` internally on them
19:40:26FromDiscord<jfmonty2> I don't know the resizing logic for strings/seqs, how much bigger than necessary can they be?
19:48:23FromDiscord<planetis> see lib/system/seqsv2 strsv2.nim
19:48:52FromDiscord<planetis> len plus 2/3 for seqs if i remember
19:50:09FromDiscord<planetis> take a look at the generated c you will figure it out
19:50:53FromDiscord<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:05FromDiscord<codic> 👍
20:29:38fn<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:15FromDiscord<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:51FromDiscord<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:33FromDiscord<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:07FromDiscord<@bracketmaster-5a708063d73408ce4> has anyone ever compared nim vs swift?
22:01:12FromDiscord<@bracketmaster-5a708063d73408ce4> swift can do DSL too apparently
22:01:21FromDiscord<@bracketmaster-5a708063d73408ce4> and Swift also has ARC
22:19:14FromDiscord<Hi02Hi> In reply to @@bracketmaster-5a708063d73408ce4 "and Swift also has": different to nim's arc
22:19:24FromDiscord<Hi02Hi> (edit) "to" => "from"
22:24:47FromDiscord<treeform> Nearly every language can do DSL, its just "how well" can it do it.
22:26:39FromDiscord<@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:03FromDiscord<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:09FromDiscord<SirJosh> (edit) "that" => "the most recent"