<< 20-04-2024 >>

00:00:57FromDiscord<firasuke> In reply to @Elegantbeef "<@248208053952970752> you did sorta": ahahaha xD thought so
00:02:54FromDiscord<firasuke> so what are the numbers?
00:03:24FromDiscord<Elegantbeef> I did not run any tests but it's \~22s on my Ryzen 5600x with a sata ssd
00:03:29FromDiscord<Elegantbeef> So the output might be wrong
00:04:06FromDiscord<firasuke> it's not working on my machine
00:04:13FromDiscord<Elegantbeef> Ruhroh
00:04:47FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#pasty=GHrdiyelYEDk
00:04:55FromDiscord<Elegantbeef> you didn't provide the file
00:05:06FromDiscord<firasuke> ah my bad
00:05:22FromDiscord<firasuke> how big is the file?
00:05:31FromDiscord<Elegantbeef> I used a billion lines here
00:05:42FromDiscord<Elegantbeef> 13.8gb
00:05:56FromDiscord<firasuke> ah ok
00:06:01FromDiscord<Elegantbeef> This is a wildly IO benchmark
00:06:26FromDiscord<firasuke> wonder if the length of the line plays a role
00:06:37FromDiscord<Elegantbeef> Well I have to implementations
00:06:46*nyeaa49284230101 quit (Ping timeout: 255 seconds)
00:06:59FromDiscord<Elegantbeef> `-d:naive` does a simple `readLine` and then the other does a wide buffer which I think was 4096 bytes in that version
00:07:03FromDiscord<Elegantbeef> two implementations\
00:07:40FromDiscord<Elegantbeef> Given that the wide buffer performs the same as the naive approach I'm assuming I've hit IO limits of my little sata ssd
00:08:06FromDiscord<Elegantbeef> This test really only makes sense when using a ramdisk, otherwise it's a disk benchmark
00:08:17FromDiscord<bosinski2023> @ElegantBeef and what where the baseline timings on your machine ?
00:08:30FromDiscord<Elegantbeef> When I was using a hdd it was 1min 22s
00:08:35FromDiscord<Elegantbeef> Baseline?
00:08:35FromDiscord<firasuke> ah ok
00:08:40FromDiscord<Elegantbeef> I only ran my code
00:09:33FromDiscord<bosinski2023> @ElegantBeef ic, i'm just curious..
00:10:01FromDiscord<firasuke> Try this https://media.discordapp.net/attachments/371759389889003532/1231034100777746485/brcoptimize?ex=66357cd9&is=662307d9&hm=269b7feebc2e60a4967ab51448def50ffc23fa805d477049c36a48f665b98b20&
00:10:24FromDiscord<Elegantbeef> Hello random binary
00:10:25FromDiscord<firasuke> it's built with a more optimized toolchain
00:10:35FromDiscord<firasuke> In reply to @Elegantbeef "Hello random binary": exactly
00:10:47FromDiscord<Elegantbeef> I'm scared to run random binaries without context
00:11:28FromDiscord<bosinski2023> In reply to @Elegantbeef "I'm scared to run": same with me - i mean that somewhat a intimate thing..
00:11:30FromDiscord<firasuke> ok so I generated a 1 billion lines file size 9.3 GB
00:11:41FromDiscord<firasuke> In reply to @firasuke "Try this": takes 9 seconds to run
00:11:51FromDiscord<bosinski2023> In reply to @firasuke "ok so I generated": pls, dont post it here 🙂
00:11:53FromDiscord<Elegantbeef> What did my solution take on your machine?
00:12:10FromDiscord<firasuke> In reply to @Elegantbeef "What did my solution": 9 seconds, with an optimized toolchain build
00:12:26FromDiscord<firasuke> Ima try with a regular `nim c`
00:12:29FromDiscord<Elegantbeef> Which means `-d:lto -d:release --cc:clang` 😄
00:12:59FromDiscord<bosinski2023> In reply to @Elegantbeef "Which means `-d:lto -d:release": why not `-d:danger` ?
00:13:02FromDiscord<Elegantbeef> I still say this is mostly a disk IO problem, if your disk IO is too slow to saturate your threads more threads do not help
00:14:17*def- quit (Quit: -)
00:14:25FromDiscord<Elegantbeef> Well it's the same result with danger/release since the blockage is IO 😄
00:14:35FromDiscord<firasuke> In reply to @firasuke "Ima try with a": this took over 30 seconds and still didn't finish
00:15:02FromDiscord<Elegantbeef> By regular Nim you mean release?
00:15:04FromDiscord<Elegantbeef> Or debug
00:15:12FromDiscord<firasuke> debug
00:15:21FromDiscord<firasuke> In reply to @Elegantbeef "Which means `-d:lto -d:release": this took 9 seconds as well, without clang
00:15:41FromDiscord<Elegantbeef> Benchmarking debug is a fools errand
00:15:47FromDiscord<Elegantbeef> It's intentionally slow
00:15:53FromDiscord<firasuke> yeah xD I forgot regular is debug
00:16:16FromDiscord<Elegantbeef> Well it's not intentionally slow but adding diagnostics results in slowness
00:16:27FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#pasty=SUKcwSOpTkRy
00:16:28FromDiscord<Elegantbeef> What's your processor?
00:16:33FromDiscord<firasuke> it generally gives good results
00:16:45FromDiscord<firasuke> In reply to @Elegantbeef "What's your processor?": 5500U
00:17:06FromDiscord<Elegantbeef> I assume you then have a m.2 pcie ssd 😄
00:17:18FromDiscord<firasuke> probably
00:17:34FromDiscord<Elegantbeef> Explains why you're twice my speed
00:18:10FromDiscord<Elegantbeef> Who has the ram for a ramdisk just for shits and giggles
00:18:24FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#pasty=MciYRZuXoYie
00:18:30FromDiscord<Elegantbeef> I only have 16gb so no jovial ramdisk for me
00:18:51*def- joined #nim
00:19:44FromDiscord<firasuke> xD
00:19:59FromDiscord<Elegantbeef> Do you have any of the other 1brcs?
00:20:00FromDiscord<firasuke> In reply to @firasuke "I use this as": I call this "Magic"
00:20:14FromDiscord<Elegantbeef> I call it tedious and unsafe 😛
00:20:40FromDiscord<firasuke> In reply to @Elegantbeef "Do you have any": not really, I might try go, zig and Rust's versions
00:20:52FromDiscord<firasuke> but yeah we're already pretty fast
00:21:33FromDiscord<firasuke> zig is also at 10 seconds
00:21:59FromDiscord<firasuke> In reply to @Elegantbeef "I call it tedious": oh why?
00:23:04FromDiscord<Elegantbeef> Stupid fast given how little code it took
00:23:04FromDiscord<Elegantbeef> The java examples are super bloated
00:23:04FromDiscord<Elegantbeef> I also still don't know if my non naive solution gives the correct result
00:23:27FromDiscord<Elegantbeef> `-d:danger` implies `-d:release`
00:23:45FromDiscord<Elegantbeef> `--opt:speed` is default
00:23:48FromDiscord<Elegantbeef> `--threads:on` is default in 2.0+
00:23:58FromDiscord<Elegantbeef> That's a lot of C flags
00:24:21FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "The java examples are": Reminds me of the C# RPS impl vs Nim
00:24:37FromDiscord<Elegantbeef> https://github.com/gunnarmorling/1brc/blob/main/src/main/java/dev/morling/onebrc/CalculateAverage_royvanrijn.java this is the fastest java implementation
00:24:52FromDiscord<Elegantbeef> 500 loc
00:25:16FromDiscord<Elegantbeef> We'll say it's 400 optimistically due to comments
00:25:34FromDiscord<Elegantbeef> I have slightly different implementations and mines 120 😄
00:26:10FromDiscord<firasuke> In reply to @Elegantbeef "Stupid fast given how": I was surprised honestly
00:26:26FromDiscord<Robyn [She/Her]> C#: https://paste.ecorous.org/sefafijiju↵Nim: https://paste.ecorous.org/ocowedohiy
00:26:53FromDiscord<Robyn [She/Her]> (edit) "C#: https://paste.ecorous.org/sefafijiju↵Nim:" => "Nim: https://paste.ecorous.org/sefafijiju↵C#:"
00:27:46FromDiscord<Elegantbeef> Robyn given the whitespace the nim code has, your example has failed 😄
00:27:46FromDiscord<Elegantbeef> `return case i`...
00:27:47FromDiscord<Elegantbeef> Who wrote this?
00:28:59FromDiscord<Robyn [She/Her]> Me, while feeling like I was gonna fall asleep
00:29:07FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Robyn given the whitespace": The newlines?
00:29:21FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1231038965117620325/image.png?ex=66245de0&is=66230c60&hm=6f241514bee5ba375e2d581f2bfe2eb4ae799bbed8ed6b480657bf31f1fc2fd5&
00:30:06FromDiscord<Robyn [She/Her]> Oh yeah I have no excuse for that lol
00:33:35FromDiscord<bosinski2023> In reply to @Elegantbeef "image.png": we'd call it airy which is luftig in german - i like it.
00:34:03FromDiscord<Elegantbeef> Of course it's airy it deserves to be burned
00:34:29FromDiscord<bosinski2023> In reply to @Elegantbeef "Of course it's airy": danger ahead - the style-inquisition is coming ..
00:36:12FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=uhZJHETbdhoR
00:37:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=YjeOzaYYPnlX
00:38:14FromDiscord<Elegantbeef> We can do event better `Item(ord(item) - 1 mod(item.high + 1))`
00:38:18FromDiscord<Elegantbeef> even\
00:38:30FromDiscord<Elegantbeef> Whoops typed that too fast
00:38:54FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=AwkFjczBtWcL
00:39:00FromDiscord<Elegantbeef> `Item((item.ord - 1) mod (item.high.ord + 1))`
00:39:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=AOgFXcLhCpSu
00:39:47FromDiscord<sOkam! 🫐> In reply to @Elegantbeef "`Item((item.ord - 1) mod": but then they cannot change the enum order willingly to cheat against their friends :babyrage:
00:40:44FromDiscord<Elegantbeef> That's still wrong but meh if anyone wants to do the math do it
00:42:04FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=aKWqwfrwXNwK
00:48:52*def- quit (Quit: -)
00:50:33*disso-peach quit (Quit: Leaving)
01:10:27*def- joined #nim
02:08:34*rockcavera quit (Remote host closed the connection)
02:35:08*def- quit (Quit: -)
02:35:48*def- joined #nim
02:39:50*def- quit (Client Quit)
02:41:32*def- joined #nim
04:55:33*def- quit (Quit: -)
04:55:52*def- joined #nim
05:31:53*def- quit (Quit: -)
05:35:04*def- joined #nim
05:49:11*def- quit (Quit: -)
06:10:33*def- joined #nim
06:12:45*coldfeet joined #nim
06:15:03*def- quit (Quit: -)
06:16:08*def- joined #nim
06:36:05*def- quit (Quit: -)
06:36:45*def- joined #nim
06:51:29*coldfeet quit (Remote host closed the connection)
06:53:16*ntat joined #nim
07:03:01FromDiscord<aryzen> Heya! I'm trying to install this: https://github.com/n0bra1n3r/cinterop?tab=readme-ov-file↵↵using Nimble, which it claims to be on, but it doesn't turn up in search
07:16:49FromDiscord<sOkam! 🫐> is there a way to replace `std/httpclient` with other library that also allows downloading files in some way?
07:17:03FromDiscord<sOkam! 🫐> asking becuase making them work on windows is janky af
07:17:15FromDiscord<kots> In reply to @aryzen "Heya! I'm trying to": It probably supports nimble but isn't on the central listing. Try installing it using the GitHub url instead of the package name
07:17:36FromDiscord<Elegantbeef> `puppy` is there sokam
07:19:49FromDiscord<sOkam! 🫐> `could not load: (libcrypto-1_1-x64|libeay64).dll` 😦
07:20:21FromDiscord<sOkam! 🫐> that's what I'm trying to solve↵all i really do is download a file, but don't know how to do that with puppy. am I being obtuse?
07:21:07FromDiscord<Elegantbeef> `get`
07:21:13FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=YpHQcedDCFyd
07:21:35FromDiscord<Elegantbeef> `get(url).writeFile(...)`
07:21:45FromDiscord<sOkam! 🫐> let me try that
07:21:45FromDiscord<Elegantbeef> If you need streaming you have to do otherstuff
07:21:56FromDiscord<sOkam! 🫐> nah, its just download to file
07:22:26FromDiscord<aryzen> In reply to @k0ts "It probably supports nimble": Oh, thank you!
07:23:27FromDiscord<Elegantbeef> Right but sometimes files are big
07:24:15*def- quit (Quit: -)
07:24:24FromDiscord<sOkam! 🫐> ah good point
07:25:07*def- joined #nim
07:25:08FromDiscord<sOkam! 🫐> what does puppy link to on windows?
07:25:15FromDiscord<sOkam! 🫐> is it static or dynamic?
07:25:24FromDiscord<sOkam! 🫐> coming from treeform, i'd be surprised if its static
07:25:57FromDiscord<Elegantbeef> It uses system libraries
07:26:05FromDiscord<Elegantbeef> So it's dynamically linked to windows libs
07:27:55FromDiscord<sOkam! 🫐> kk
07:28:24FromDiscord<sOkam! 🫐> In reply to @Elegantbeef "`get(url).writeFile(...)`": does not worky. did you mean something else?
07:28:36FromDiscord<Elegantbeef> No what do you get?
07:28:38FromDiscord<sOkam! 🫐> there is no writefile for the response
07:28:53FromDiscord<Elegantbeef> `response.body`
07:33:05FromDiscord<aryzen> Oh ok, weird, so, nimsuggest just won't suggest imports for nimble packages?
07:33:49FromDiscord<Elegantbeef> Not that weird given how adhoc importing is
07:38:56FromDiscord<aryzen> ~~the nimsaem plugin does support it???~~
07:39:07FromDiscord<Elegantbeef> Oh
07:39:34FromDiscord<aryzen> is the nimsaem one actually abandoned? It was updated last month
07:40:54FromDiscord<Elegantbeef> He is apart of the nimskull devs so it's not likely to stay compatible
07:41:05FromDiscord<aryzen> ohh I see..
07:42:48*MacDefender joined #nim
07:43:03FromDiscord<aryzen> frustrating because this one seems to work that little bit better
07:44:59FromDiscord<sOkam! 🫐> How can I track what parts of my code exactly are loading this?↵`could not load: (libcrypto-1_1-x64|libeay64).dll`
07:45:19*coldfeet joined #nim
07:45:22FromDiscord<sOkam! 🫐> im searching for `define:ssl` and `std/httpclient` but I don't have them anymore, or at least cant find them
07:45:53*def- quit (Quit: -)
07:46:12FromDiscord<sOkam! 🫐> oh... its importing from another folder that is not reached by vscode search for some reason
08:16:53FromDiscord<aryzen> is there anywhere I can find how to use a config.nims file?
08:17:11FromDiscord<aryzen> like, a basic working example of one?
08:22:27*def- joined #nim
08:23:33FromDiscord<sOkam! 🫐> In reply to @aryzen "is there anywhere I": what is your usecase?
08:23:52FromDiscord<sOkam! 🫐> i don't remember such an example, but the idea is simple. so might be able to give an example based on what you want to achieve
08:31:34FromDiscord<aryzen> basically... I just want to use `--path:'.'` but I don't really know how to do that
08:35:58FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=gCoLEjNOpvvQ
08:39:22FromDiscord<aryzen> and then if I wanted to use this, would I have to ask it to build my main file?
08:40:17FromDiscord<sOkam! 🫐> In reply to @aryzen "and then if I": since you mentioned `.nims`, you would run either `nimble build` or `nimble c youfile.nim`
08:44:41FromDiscord<aryzen> so I would do, in this case, `nimble c main.nim`, when I used to do `nim c main.nim`?
08:44:57FromDiscord<sOkam! 🫐> if you want to use `.nims`, yes
08:45:13FromDiscord<sOkam! 🫐> you can also use `.cfg` for `nim c file.nim`
08:45:26FromDiscord<aryzen> and I can pass it mostly the same args, or would I put those in the nims?
08:45:49FromDiscord<sOkam! 🫐> its just a wrapper for nim c, afaik
08:45:53FromDiscord<aryzen> I C
08:46:11FromDiscord<aryzen> Cuz all I'm trying to do is get it to find a file that's a few subdirectories deep
08:46:48FromDiscord<aryzen> Trying to get it to work with a C++ library, so I put my interop nim in the /include folder
08:46:53FromDiscord<sOkam! 🫐> can you do `import ./one/two/three/four/five/six.nim`? its usually better architecture
08:47:20FromDiscord<sOkam! 🫐> depending on the buildsystem to do that type of stuff is very error-prone
08:48:02FromDiscord<aryzen> ohh, I have to put the `.` first... 🤦
08:48:33FromDiscord<sOkam! 🫐> you don't "have" to, but its clearer to read
08:48:46FromDiscord<sOkam! 🫐> at least imo. other people prefer not to
08:48:47FromDiscord<aryzen> It wouldn't find the file otherwise
08:48:53FromDiscord<aryzen> or, may still not
08:48:54FromDiscord<sOkam! 🫐> oh
08:50:22FromDiscord<aryzen> well, part of it is it thinks `include` is a keyword so it searches `Lib//myFile` and can't find it
08:51:08FromDiscord<sOkam! 🫐> In reply to @aryzen "well, part of it": `import ./thing/other/"include"`
08:51:37FromDiscord<sOkam! 🫐> but I feel like this issue is happening for thinking to much in cpp land
08:52:06FromDiscord<aryzen> I don't want to be in cpp land, but there are no graphics libs to use
08:52:24FromDiscord<aryzen> ~~in fact I never learned cpp at all, I come from C#~~
08:52:57FromDiscord<sOkam! 🫐> sokol is C, fwk is C, opengl same, vulkan same, wgpu-native same
08:53:44FromDiscord<aryzen> I'm trying to use filament, which serves a lot of my needs, and I also want to learn nim; they both match my needs very well
08:54:46FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=LeRAlxdsaQli
08:55:15FromDiscord<sOkam! 🫐> In reply to @aryzen "I'm trying to use": realize then, that you are multiplying your complexity by at least 10x or 20x
08:55:25FromDiscord<aryzen> fine enough by me
08:55:32FromDiscord<sOkam! 🫐> learning nim AND interop at once is beyond hard
08:55:58FromDiscord<aryzen> nim itself is extremely easy; it's the tools I'm too stupid to get XD
08:56:19FromDiscord<sOkam! 🫐> just remember that, and don't get discouraged. just letting you know, because i've been there and got demotivated, and left by accident not by choice
08:56:41FromDiscord<sOkam! 🫐> In reply to @aryzen "nim itself is extremely": you are not stupid. nim tooling is not intuitive, and interop is not easy to learn
08:56:59FromDiscord<sOkam! 🫐> tooling is probably the worst part of nim by far
08:57:12FromDiscord<sOkam! 🫐> it works, just not intuitively and not the best ux
08:57:57FromDiscord<sOkam! 🫐> are you making a wrapper for filament, btw?
08:58:15FromDiscord<aryzen> I've been bashing my head at C# and Swift interop for long enough and those languages didn't do quite what I wanted to begin with; and I certainly didn't wanna learn C++... It's just, not right to me
08:58:24FromDiscord<aryzen> Yeah, wrapper
08:58:31FromDiscord<aryzen> and I guess an engine some day
08:58:36FromDiscord<sOkam! 🫐> then 100% go with what I explained
08:58:51FromDiscord<sOkam! 🫐> i have a similar-ish setup on nglfw, let me give you a link
08:58:53FromDiscord<Elegantbeef> Isn't filament a C++ engine with no C header?
08:58:58FromDiscord<Elegantbeef> So you need to learn C++ 😄
08:59:36FromDiscord<aryzen> yes, it has no C; I have to learn C++ as far as I need to get what functionality I want; more can come after
08:59:40FromDiscord<sOkam! 🫐> @aryzen https://github.com/heysokam/nglfw/blob/master/src/nglfw/compile.nim
09:00:07FromDiscord<sOkam! 🫐> that file is a replacement for glfw's cmake build setup
09:00:29FromDiscord<sOkam! 🫐> so it has a ton of what you need, as references on how to build stuff from the nim compiler
09:00:52FromDiscord<sOkam! 🫐> when you use nglfw, you just do `import nglfw` and the library builds glfw directly. that's the idea of that file
09:01:01FromDiscord<aryzen> that's neat
09:01:12FromDiscord<sOkam! 🫐> you likely want something similar-ish, but probably calling for the filament's buildsystem instead
09:02:01FromDiscord<sOkam! 🫐> i recommend going with their buildsystem, whatever it is, and just asking for the commands within a `static: ...` block↵otherwise you have to recreate their buildsystem, and its a massive PITA
09:02:17FromDiscord<sOkam! 🫐> it works for glfw because its really simple. but anything beyond that... its a mess
09:02:45FromDiscord<Elegantbeef> You can also just modify their build system to compile your Nim source files
09:03:00FromDiscord<Elegantbeef> Well consume the generated files
09:03:20FromDiscord<sOkam! 🫐> having dealt with too many buildsystems to count, that's like asking to be tortured
09:03:31FromDiscord<sOkam! 🫐> its doable, but... oof
09:03:48FromDiscord<aryzen> Well, I'll sleep on it. This stuff should be super useful
09:03:51FromDiscord<aryzen> Thanks!
09:04:05FromDiscord<sOkam! 🫐> rest well ✍️
09:04:11FromDiscord<aryzen> 👋
09:04:19FromDiscord<Elegantbeef> Depending how it's setup it can be pretty simple to do
09:04:50FromDiscord<Elegantbeef> The rpi pico was easy to do since one just had to add a command that said "compile all the files in here"
09:08:04FromDiscord<firasuke> How can you implement a find-like search? Is `walkDir` the right way?
09:08:58FromDiscord<Elegantbeef> `walkDirRec` is even easier
09:09:26FromDiscord<firasuke> In reply to @Elegantbeef "`walkDirRec` is even easier": Yes, I want a `find -maxdepth 1`
09:09:35FromDiscord<firasuke> with globbing
09:09:56FromDiscord<firasuke> I was thinking to recurse over `walkDir` and check `if in`
09:16:11FromDiscord<sOkam! 🫐> In reply to @firasuke "with globbing": ignore the `DirFile` type, its just an abstraction to separate dir from file↵https://github.com/heysokam/confy/blob/f1394401bec3c6b3bffbfeab7cd7a62d43d5dafe/src/confy/dirs.nim#L84-L94↵that's what I use for globbing myself
09:16:33FromDiscord<sOkam! 🫐> I don't have pattern matching, but some functions from std do allow to use it
09:17:46FromDiscord<firasuke> oh ok, ima check that out, thanks
09:34:54FromDiscord<firasuke> ok so I have a bunch of `styledEcho`es that I want to group into a template or a macro of some sort:↵https://github.com/glaucuslinux/radula/blob/main/src/ceras.nim
09:35:26FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#pasty=zuqoIWdZkAZV
09:35:55FromDiscord<firasuke> Is there a better way to do this?
11:37:39FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=bPHNheciTZjU
11:45:56*def- quit (Quit: -)
11:47:19*def- joined #nim
12:46:46*def- quit (Quit: -)
12:46:58*def- joined #nim
13:00:39FromDiscord<Phil> I'm trying to wrap my head around the structure of rex and I'm falling short, I'll be honest
13:12:18FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=wTLPkWaDsjaN
13:12:26FromDiscord<Phil> (edit) "https://play.nim-lang.org/#pasty=itKCSEIzEwxW" => "https://play.nim-lang.org/#pasty=XkivcEdGuVMN"
13:14:49FromDiscord<odexine> whats rex from? did that one library i saw a few days ago change name or smth
13:16:08FromDiscord<Phil> Nah, new lib, somebody playing around with reactive programming in nim
13:16:28FromDiscord<Phil> It's more a poc than anything tbh and has some limitations that aren't appealing
13:16:44FromDiscord<Phil> Like an `enable` proc call on the observable is what triggers sending values through the observers
13:17:12FromDiscord<Phil> And multiple calls to that will emit the same values to all observers. Subscribing does not mean you immediately receive the values.↵No operators yet, no subjects
13:19:22FromDiscord<Phil> Actually I take that back, it does have subjects
13:20:25FromDiscord<Phil> They're just kinda rolled into the observables themselves
13:52:20*MacDef joined #nim
13:55:12*MacDefender quit (Ping timeout: 260 seconds)
14:06:19*def- quit (Quit: -)
14:07:22*def- joined #nim
15:22:48*giggoX joined #nim
15:23:35giggoXall alive?
15:26:25*giggoX left #nim (#nim)
15:26:25*def- quit (Quit: -)
15:26:37*def- joined #nim
15:46:27FromDiscord<the_real_hypno> Any idea why i get SIGSEV even though the program finished successfully?
15:47:13FromDiscord<the_real_hypno> Is that the issue with 2.0 and the need to use malloc?
15:48:24FromDiscord<sOkam! 🫐> In reply to @the_real_hypno "Any idea why i": there could be a lot of reasons
15:48:35FromDiscord<sOkam! 🫐> failing to initialize a `ref` object could also do that
15:49:05FromDiscord<sOkam! 🫐> it basically means "hey, that memory you are accessing doesn't belong to you, you can't touch that"
15:49:06FromDiscord<the_real_hypno> Im calling a IOCTL code to my kernel driver. And the respond is correcz
15:49:19FromDiscord<the_real_hypno> Then i get SigSev
15:49:31FromDiscord<the_real_hypno> In reply to @heysokam "it basically means "hey,": Oooh
15:49:39FromDiscord<the_real_hypno> That could be
15:50:05FromDiscord<the_real_hypno> But the request only returns a bool
15:50:45FromDiscord<the_real_hypno> Even if I discard the return its happening
16:00:59FromDiscord<the_real_hypno> https://media.discordapp.net/attachments/371759389889003532/1231273419450880041/image.png?ex=66365bbb&is=6623e6bb&hm=3c69bcbc39281c61238f0aaaac24f3989ff951e53c0a98c5640fb2f611142528&
16:01:25FromDiscord<the_real_hypno> Im lost. Its working flawelessly ¯\_(ツ)_/¯
16:13:27FromDiscord<sOkam! 🫐> In reply to @the_real_hypno "Im lost. Its working": debugger is the only way to properly track sigsev
16:13:36FromDiscord<sOkam! 🫐> otherwise you are just blind-guessing
16:21:38FromDiscord<the_real_hypno> ok well
16:21:47FromDiscord<the_real_hypno> looks like Nim tries to read Kernel space
16:21:48FromDiscord<the_real_hypno> Exception 0xc0000005 encountered at address 0x7ff7618e5237: Access violation reading location 0xfffff806e1f093a0
16:22:32FromDiscord<the_real_hypno> But i have no idea why. That shouldnt happen at all. That must be some underlying thing thats happening
16:23:09FromDiscord<sOkam! 🫐> are you using some `seq[T]` or `string` and interacting with the kernel with that data?
16:24:06FromDiscord<sOkam! 🫐> asking in case you are accidentally saying `thing.addr` instead of `thing[0].addr`. its an easy one to fall into
16:28:53FromDiscord<the_real_hypno> Ye well, no i have it
16:29:28FromDiscord<the_real_hypno> Apparently running in -d:debug somehow animated Nim to read everything around that IOCTL request aswell
16:29:52FromDiscord<the_real_hypno> -d:release and presaving the result in a let works
16:30:46FromDiscord<the_real_hypno> But im not really happy with that tbh 😄 ↵If someone has ideas im still open for input
16:30:52FromDiscord<the_real_hypno> Anyway thanks for the help @sOkam! 🫐
16:41:34FromDiscord<demotomohiro> I think understanding correctly how your code, library or API works helps why sigsev happened.↵Sometimes I use library/API functions without knowing restrictions that is written on the manual.
16:50:40FromDiscord<the_real_hypno> Well. Since im not using any API, thats not really a thing here. Im using self-defined types communicating via IOTCL Codes with a working and tested driver.
16:51:01FromDiscord<the_real_hypno> The only thing that can interefere is Nim base
16:52:41FromDiscord<jviega> But if there’s a seq or string in there the representation isn’t what it is in C so won’t do what you think
16:54:56FromDiscord<the_real_hypno> There are no strings in IOCTL ..
16:55:16FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=gpfJeoPLCDBz
16:55:41*def- quit (Quit: -)
16:55:44FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=KFFrhsiacJOJ
16:56:09FromDiscord<the_real_hypno> And the return is an integer. Nothing else. Not sequence, no string involves
16:56:11FromDiscord<the_real_hypno> (edit) "involves" => "involved"
16:56:18FromDiscord<the_real_hypno> (edit) "Not" => "No"
16:58:49FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=jwbJNumjnQgV
16:59:47FromDiscord<sOkam! 🫐> important because if you have issues inside a template, you are on your own. but if you have issues inside a func/proc then the compiler will properly warn you
17:00:06FromDiscord<the_real_hypno> But there is no issue in my template 😛
17:00:09FromDiscord<sOkam! 🫐> templates are last-resort things in nim
17:00:26FromDiscord<sOkam! 🫐> In reply to @the_real_hypno "But there is no": i know, im explaining because i know this is a very C thing to think
17:00:32FromDiscord<the_real_hypno> Since its just math, one can calculate it
17:00:36FromDiscord<sOkam! 🫐> but its nim, there are proper types and generics
17:00:44FromDiscord<jviega> Which is what the behavior sounds like
17:02:30FromDiscord<the_real_hypno> Anyway. I used a template because i like templates. Not to be close to C. But again, thanks for the tip.
17:02:35FromDiscord<jviega> Well the ioctl call is going to be an issue. You’re passing something wrong. I’ve used icotl through nim 100 times it works fine
17:03:05FromDiscord<jviega> More code == more help
17:03:50FromDiscord<the_real_hypno> The only point where something COULD be wrong with the IOCTL call can be on Nims side, because i already wrote the same Program in C++
17:05:08FromDiscord<jviega> Yes and like we said it is likely due to some misunderstanding but it’s really hard to help you without a lot more context
17:05:08FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=HHjephSRcidG
17:05:21FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=woaGEKAzrCxE
17:05:28FromDiscord<the_real_hypno> (edit) "https://play.nim-lang.org/#pasty=QvdxGbNMnmDi" => "https://play.nim-lang.org/#pasty=wcuqqoiNZsyA"
17:06:55FromDiscord<the_real_hypno> sent a long message, see https://pasty.ee/QPyFyozMssNS
17:07:19FromDiscord<jviega> I don’t see the flow down to an ioctl call. Any of those 64 bit ints there being passed where a 32 bit int is expected?
17:08:09FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=ZDqNWQZjVKUC
17:08:33FromDiscord<the_real_hypno> and the calculation returns 2229388 for nim aswell
17:09:07FromDiscord<the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=QlgGNyKIbMIc
17:09:20FromDiscord<the_real_hypno> (edit) "https://play.nim-lang.org/#pasty=vFDTvNxXLEnm" => "https://play.nim-lang.org/#pasty=OjqXKBdsnKFL"
17:10:21FromDiscord<the_real_hypno> which also works
17:10:23FromDiscord<the_real_hypno> https://media.discordapp.net/attachments/371759389889003532/1231290880196083825/image.png?ex=66366bfe&is=6623f6fe&hm=c471ecb988484e558c1d1f8b33bb02266024808f3ea7965137b8812b0e0b8f7e&
17:11:01FromDiscord<jviega> So ioctl’s signature is 2 32 bit ints and then additional args based on the code and the semantics of the call are based on ioctal. I see you packing a 64 bit value but nfc what you’re doing w it really since I’m getting snippets
17:11:46FromDiscord<jviega> But if you’re passing a 64 bit value to one of those first two arcs you’re doing it wrong
17:13:28FromDiscord<the_real_hypno> sent a long message, see https://pasty.ee/UzbdBGJWcCoP
17:14:42FromDiscord<the_real_hypno> Also the call happens with a .DWORD convert
17:14:44FromDiscord<jviega> I’m not saying it isn’t nim’s fault somehow but it’s very unlikely to be a nim bug and more likely to be yours. Either way you’re not making it easy to help you and I’m going to go back to my weekend
17:14:45FromDiscord<the_real_hypno> Which is int32
17:15:22FromDiscord<the_real_hypno> Yes, have fun
17:16:01*def- joined #nim
17:19:03*def- quit (Client Quit)
17:21:12*def- joined #nim
17:30:23FromDiscord<jviega> On my phone but how truncation might happen depends on the code, compiler and calling convention. It would be really easy to end up with a mistake if you’re cavalier enough to just pass down a long and assume it’s going to work. Definitely make sure to see what you’re getting on the C side vs what you think you passed
17:31:20FromDiscord<norax.2> yoo managed to get a "job" in something related to code https://media.discordapp.net/attachments/371759389889003532/1231296156311490560/image.png?ex=663670e8&is=6623fbe8&hm=c0ae650c46112d49896368405e2ad692cdd5ca9dda6ae8218f7d6c1ebcee2ca9&
17:31:26FromDiscord<norax.2> (indeed nim)
17:31:51FromDiscord<norax.2> is there any excel-like lib?
17:32:29FromDiscord<nnsee> In reply to @norax.2 "yoo managed to get": why did you put job in quotes
17:32:48FromDiscord<norax.2> cause 1 im not even 18 2 is for a friend that pays me just for this
17:32:56FromDiscord<norax.2> (edit) "cause 1 im not even 18 2 is for a friend that pays me just for this ... " added "single thing"
17:33:26FromDiscord<nnsee> well done regardless
17:34:07FromDiscord<norax.2> but heck i dint even know what VAT(according to chatgpt the english version of iva)
17:34:12FromDiscord<norax.2> (edit) "but heck i dint even know what VAT(according to chatgpt the english version of iva) ... " added "was"
17:34:55FromDiscord<nnsee> in any case what do you mean by excel like lib?
17:35:06FromDiscord<norax.2> In reply to @nnsee "in any case what": to create excel
17:35:09FromDiscord<nnsee> do you need to edit excel documents? or do you want to manipulate data or
17:35:09FromDiscord<norax.2> edit them
17:35:14FromDiscord<norax.2> both
17:35:14FromDiscord<nnsee> oh, well
17:36:26FromDiscord<nnsee> for editing, there's https://github.com/mashingan/excelin and https://github.com/ringabout/xlsx
17:37:47FromDiscord<wileycoleman> sent a long message, see https://pasty.ee/qcLqiQFabzyz
17:37:59*krux02 joined #nim
17:38:06FromDiscord<norax.2> In reply to @nnsee "for editing, there's https://github.com/mashingan/e": ty
17:38:19FromDiscord<nnsee> In reply to @wileycoleman "I would appreciate some": i've found pixie nice to use for image manipulation
17:39:08FromDiscord<nnsee> oh, apparently i even wrote a file format parser/writer for it
17:39:11FromDiscord<nnsee> interesting
17:39:52FromDiscord<nnsee> at some points i feel i should be worried about my memory or lack thereof
17:40:00FromDiscord<norax.2> insane my nim to exe thing (from unix) still works https://media.discordapp.net/attachments/371759389889003532/1231298333151330344/image.png?ex=663672ef&is=6623fdef&hm=8a319a654b8dcf6aa6f8db82c06c7a5a8dc4eb1acf46d333b8179f4a891cd675&
17:40:07FromDiscord<norax.2> no idea how
17:43:04FromDiscord<wileycoleman> In reply to @nnsee "oh, apparently i even": Does is clip jpeg or just png? I found examples of cairo being used to clip png files. Maybe I can convert from jpg to png then use cairo. Not sure which of many nimbles to use for cairo though.
17:43:30FromDiscord<wileycoleman> (edit) "is" => "it"
17:48:02FromDiscord<nnsee> In reply to @wileycoleman "Does it clip jpeg": these are the file formats it supports https://media.discordapp.net/attachments/371759389889003532/1231300356432990250/Screenshot_20240420-204743_Firefox.png?ex=663674d1&is=6623ffd1&hm=2432080d13e499424f2e0ffcefd03324f035ffeb8315005ad8168e5c0717ac06&
17:48:03FromDiscord<nnsee> from the readme
17:55:33*MacDef quit (Quit: WeeChat 4.2.2)
17:57:55FromDiscord<sOkam! 🫐> In reply to @wileycoleman "Does it clip jpeg": treeform's cairo version was the best I found by far
17:58:09FromDiscord<sOkam! 🫐> but avoid cairo ifyou can, its not very cross-platform friendly
17:58:31FromDiscord<sOkam! 🫐> `treeform/pixie` is much better in general
17:59:57FromDiscord<Phil> Out of curiosity, has anyone here messed around with the observable pattern or reactive programming in-depth in general?
18:00:55NimEventerNew thread by FernandoTorresG: What's the lowest level that Nim can navigate or even dive breaking OS-dependant protected modes?, see https://forum.nim-lang.org/t/11465
18:06:37FromDiscord<wileycoleman> In reply to @isofruit "Out of curiosity, has": I am new here. I have written a few programs using svelte which is reactive. Its very nice.
18:06:57FromDiscord<sOkam! 🫐> In reply to @NimEventer "New thread by FernandoTorresG:": ^ man, people don't really understand the concept of `systems programming` doesn't depend on language choice, don't they 😔
18:08:00FromDiscord<Phil> In reply to @wileycoleman "I am new here.": More along the lines of "If I were to implement observables/subjects - what would the basic types in nim look like?"↵The fact that nim has no RxNim or the like has been a sticking point, though a new lib has propped up earlier that starts out with a sort-of Subject implementation that looks like it works decently well
18:08:09FromDiscord<sOkam! 🫐> @Phil how could reactive programming look like in nim, in simple terms? never looked into the term, so curious
18:09:11FromDiscord<Phil> In reply to @heysokam "<@180601887916163073> how could reactive": You want Observables, Subjects and operators (map, filter, tap, combine at the very least).
18:09:26FromDiscord<Phil> In a sense an Observbale is just a value that also tracks callback functions and that can be updated
18:09:34FromDiscord<Phil> (edit) "Observbale" => "Observable"
18:09:44FromDiscord<sOkam! 🫐> oh wait, reactive as in React.js?
18:09:51FromDiscord<Phil> as in RXJS
18:09:58*def- quit (Quit: -)
18:10:03FromDiscord<Phil> React.js is not necessarily reactive afaik
18:10:21FromDiscord<sOkam! 🫐> aren't react hooks reactive?
18:10:54FromDiscord<Phil> I guess in the faintest sense maybe?↵The idea is more to box specific values so that you can generate new values from them that auto-update
18:10:59FromDiscord<sOkam! 🫐> they are essentially the modern react way of doing things
18:11:49FromDiscord<sOkam! 🫐> In reply to @isofruit "I guess in the": then yeah, it is what I was talking about. I get what you mean then ✍️
18:12:29FromDiscord<sOkam! 🫐> I figured you would need some library to support it, right? 🤔
18:12:34FromDiscord<Phil> Like maybe you have an input field that the user can type a name in.↵You turn that into an observable `name$`.↵↵For a title you render somwhere you need the users name. So you create a new observable that is derived from the previous one by `map`ing to a new one `title$` that outputs `"Hey <name>"`.
18:12:39FromDiscord<sOkam! 🫐> (edit) "figured" => "figure"
18:13:07FromDiscord<Phil> And then you use `title$` to render your application.↵Changes to name will automatically also update `title$`
18:13:25FromDiscord<Phil> (edit) "And then you use `title$` to render ... your" added "a title in"
18:13:30FromDiscord<sOkam! 🫐> very useful stuff in UI lands, yeah
18:13:59FromDiscord<Phil> It's super useful
18:14:29FromDiscord<Phil> Like, reactive programming is one of half a dozen principles through which you can basically structure any UI problem.
18:14:53FromDiscord<Phil> (edit) "through which" => "that, when" | "can" => "all have them, allow you to"
18:15:11FromDiscord<Phil> In a clean manner mind you, which is not a given in UI land
18:24:01FromDiscord<Phil> WTF
18:24:17FromDiscord<Phil> Codium is just casually generating me rx-like operator procs in nim
18:24:24FromDiscord<Phil> and they work first try
18:28:43*def- joined #nim
18:32:41*coldfeet quit (Remote host closed the connection)
18:47:28FromDiscord<wileycoleman> In reply to @isofruit "WTF": That is impressive.
18:47:53FromDiscord<Phil> Maybe the logic is also just far simpler than I thought and I never approached it from this angle before. The logic inside them is really simple
18:48:07FromDiscord<Phil> It's not full RXJS levels of stuff, basically it's only acting on BehaviorSubjects in a sense
18:48:08FromDiscord<Phil> But still
18:48:16FromDiscord<ieltan> Damn, This makes me curious now
18:48:18FromDiscord<wileycoleman> The art is in knowing HOW to make the ask.
18:48:23FromDiscord<Phil> Yeah exactly
18:48:29FromDiscord<Phil> That was where I hit a brick wall before
18:48:38FromDiscord<Phil> But the new approach by the rex lib just makes it all so easy
18:49:01FromDiscord<Phil> Because they started trying to have a Subject first and didn't give a shit about normal observables, while I tried first going for an observable
18:49:05FromDiscord<Phil> And that ruined my everything
18:50:22FromDiscord<wileycoleman> I was wishing there was some type of reactive GUI for NIM or any of the modern languages. That is why I like svelte. I created that same mahjongg program mentioned above first with Python and TKinter, then with Svelte and node.
18:50:24FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#pasty=SDyCtAOBbaiM
18:50:54FromDiscord<Phil> Pondering if there's a way for me to "expand" combine into accepting arbitrary numbers of obs parameters with arbitrary types
18:51:06FromDiscord<Phil> Or at least pondering if that's possible without dipping into templates or macros
18:56:34FromDiscord<the_real_hypno> sent a long message, see https://pasty.ee/gfbCJyHPjARg
18:58:05FromDiscord<jviega> No expectation other than you clearly have to be messing up the call.
18:58:54FromDiscord<the_real_hypno> K, just wanted to let you know since ive seen your answer just now
19:00:57FromDiscord<Phil> Btw. this is the lib that is providing the base:↵https://github.com/minamorl/rex
19:01:01FromDiscord<Phil> Or rather it is a single file
19:01:10FromDiscord<Phil> That thing is super simple but it works really damn well
19:02:10FromDiscord<Phil> (edit) "well" => "well. As in, the logic seems pretty extendable"
19:08:06FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=vsFJUQPONMfU
19:10:39FromDiscord<Phil> I am too uneducated of nim's pattern matching features
19:10:46FromDiscord<Phil> But that looks invalid now matter how I shave it
19:11:11FromDiscord<Phil> My mind is screeching for the check of "o.isSom()" but I guess you intentionally wanted to go the case route here
19:11:21FromDiscord<aintea> yes
19:11:22FromDiscord<Phil> (edit) ""o.isSom()"" => ""o.isSome()""
19:11:52FromDiscord<wileycoleman> In reply to @isofruit "Btw. this is the": The name threw me for a loop. I once learned the REXX programming language! I am just starting to learn to "Read" Nim so I can't quite see how the code all works yet. My brain is wired differently.
19:11:57FromDiscord<aintea> This looks good: https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html
19:12:05FromDiscord<aintea> At one point my code worked
19:12:50FromDiscord<Phil> In reply to @wileycoleman "The name threw me": its actually not that insane or complex...well actually it is but also in some sense maybe not
19:13:10FromDiscord<Phil> So the way it currently works is, Observable is actually a subject
19:13:32FromDiscord<Phil> It just tracks callback procs and "process" is in fact a proc that triggers a bunch of "next" calls
19:13:42FromDiscord<Phil> That is sort of your observable data-provider
19:14:00FromDiscord<Phil> Which means the Observable is sort of a mixture of Obervable (since it can contain data) and Subject (Since you can trigger new values)
19:14:28FromDiscord<Phil> By calling `enable` you can trigger calling `process` which will pump a bunch of values through the "Observable"
19:15:08FromDiscord<Phil> That is kind of very unexpected behaviour so I opened an issue, they're likely going to change it so Obervable basically in its entirety behaves like a BehaviorSubject
19:18:51FromDiscord<wileycoleman> In reply to @isofruit "So the way it": To me this all muddies with water. The observable pattern should involved a value in memory, a wrapper around it that make this memory value observable. That wrapper is an object that watches that value on a periodic timer basis for changes. As soon as it sees a change it alerts the Observers for that value. How those Observers get registered and tracked is what you code.
19:19:45FromDiscord<Phil> Aye, but we can get there step by step
19:20:21FromDiscord<Phil> for the most part minamorl provided a baseline. It's always possible to work backwards and based on their "Observable" start implementing an actual Observable and rename the current stuff into Subjects
19:20:58FromDiscord<Phil> And that's really important with this kind of lib to have a good starting point. Making it more conform to ReactX standards can always come later
19:22:09FromDiscord<wileycoleman> In reply to @isofruit "for the most part": I never used React (but I am very fond of Ruby language.) Had to use Angular (shudder), then moved to VUE (much better) then moved to Svelte.
19:22:31FromDiscord<Phil> I have neither, I'm more of an expert in Angular and thus RXJS
19:22:49FromDiscord<Phil> Pays well enough
19:25:29FromDiscord<wileycoleman> In reply to @isofruit "Pays well enough": Its funny how the best paying jobs often use the most tiresome stack. (Java, Angular etc). I am retired now so I am just writing code for the absolute fun of it.
19:26:16FromDiscord<Phil> I honestly don't find Angular that bad
19:26:55FromDiscord<Phil> Though I guess for the most part I like about it that it provides a fairly uniform way of structuring the project and that you basically can beat any kind of businesslogic that product-people throw at you to a pulp with said structure
19:27:41*krux02_ joined #nim
19:27:44FromDiscord<Phil> Given how our product people tend to want to have business logic that tries to absolutely murder you in your sleep, having a default pattern that enables you to tackle anything, even if its boiler-platey, is welcome
19:30:24*krux02 quit (Ping timeout: 256 seconds)
19:31:25FromDiscord<wileycoleman> In reply to @isofruit "Given how our product": Is your hope to include an observable type into the base Nim standard library?
19:31:58FromDiscord<Phil> I want a decent lib. I don't think it's necessary for it to be part of the std lib
19:32:07FromDiscord<Phil> It just should be there
19:32:59FromDiscord<Phil> I mean, observables aren't part of the std lib of any other language I'm aware of either, the libs just need to be solid
19:45:38FromDiscord<wileycoleman> In reply to @isofruit "I mean, observables aren't": Ruby has an Observable module that comes included but in a separate library. You only have to require it but you don't have to add it after the fact as a gem (nimble).
19:45:52FromDiscord<Robyn [She/Her]> Is there a way for me to check if `myString[2..5]` is a valid range?
19:46:30FromDiscord<Robyn [She/Her]> In a single function ideally
19:46:58FromDiscord<Robyn [She/Her]> I could do a `len > ...` check but if there's an existing cleaner way that'd be nice
19:47:04FromDiscord<Robyn [She/Her]> I'll probably make my own proc actually
19:47:24FromDiscord<Phil> In reply to @wileycoleman "Ruby has an Observable": Ah, ruby is one of the languages I don't have any skills in, mine is python/TS/java/groovy/nim (and very faintly Rust), those have observables all split out.↵Interesting to see that Ruby incorporated something as comparatively less "general" of a concept in the std
19:48:41NimEventerNew thread by FernandoTorresG: What's the best way to match a standard file into a single data structure for editing it?, see https://forum.nim-lang.org/t/11466
20:16:54FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=plOJgQYDjesJ
20:17:51FromDiscord<Elegantbeef> That tells you that the following messages come from a template or generic instantiation
20:18:14FromDiscord<Elegantbeef> `is` is only used for type checking
20:18:21FromDiscord<Elegantbeef> you want `x.kind == OptionSome`
20:18:43FromDiscord<aintea> Ohhhh, that's why
20:18:59FromDiscord<aintea> Also, any idea why I get it sometimes when I write a generic operator ?
20:19:42FromDiscord<sOkam! 🫐> In reply to @aintea "Also, any idea why": generics are also types of instantiation
20:19:57FromDiscord<requiresupport> I have an idea where any code that echo's something to console, I'd like to print date time before the echo'd text. From my simple understanding macros should help me with this, but does the macro apply to stdlib code too? example the messages from stdlib stack trace? Is my idea even possible?
20:20:01FromDiscord<sOkam! 🫐> it auto-generates code for you (the instance) and executes it
20:20:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=bgnsLkGgNyea
20:20:50FromDiscord<Elegantbeef> `_: nil` is wrong cause `_` is inaccessible as a symbol and also is not typed to a `ref | pointer`
20:21:03FromDiscord<Elegantbeef> `dummy: default(T)` would've been correct but also pointless
20:21:08FromDiscord<aintea> I had no idea I could just `discard`
20:21:44FromDiscord<Elegantbeef> @requiresupport make your own echo macro that expands into `echo dateTime, ....`
20:21:57FromDiscord<aintea> Also, how could I implement pattern matching ? Something that uses the `case`
20:22:25FromDiscord<sOkam! 🫐> In reply to @aintea "I had no idea": you can because the type actually contains all fields. it just raises an exception when you try to access an unnacessible field for that kind. but the object itself contains fields
20:22:33FromDiscord<requiresupport> In reply to @Elegantbeef "<@710108871724761128> make your own": im dumb where does one starts understanding macros
20:22:33FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=DUWxKzEjJarU
20:22:35FromDiscord<Elegantbeef> Nim has no pattern matching support builtin so you use macros like fusion/matching or any other pattern matching library
20:22:46FromDiscord<Elegantbeef> My fungus library has primitive pattern matching
20:22:56FromDiscord<Elegantbeef> https://github.com/beef331/fungus?tab=readme-ov-file#fungus
20:23:05FromDiscord<aintea> I don't want to use one, I want to make one, to understand how it's done
20:23:08FromDiscord<Elegantbeef> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 @requiresupport
20:23:15FromDiscord<Elegantbeef> Right so open up the source code and look
20:23:17FromDiscord<aintea> but thanks, I'll look at your code to understand and have a starting point
20:24:22FromDiscord<requiresupport> In reply to @Elegantbeef "https://dev.to/beef331/demystification-of-macros-in": thanks so much ill start here
20:24:41FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut3.html there is also
20:25:36*def- quit (Quit: -)
20:25:52*def- joined #nim
20:27:06*ntat quit (Quit: Leaving)
21:06:14*def- quit (Quit: -)
21:07:19*def- joined #nim
21:12:42*KhazAkar joined #nim
21:58:37*_________ quit (Ping timeout: 272 seconds)
21:59:02*_________ joined #nim
22:52:28*def- quit (Quit: -)
22:52:45*def- joined #nim