<< 13-03-2025 >>

00:00:37FromDiscord<Elegantbeef> I know I do
01:11:21*alexdaguy joined #nim
02:42:16FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=gEVXlLTo
02:43:13FromDiscord<.tokyovigilante> (edit) "https://play.nim-lang.org/#pasty=QRxHYHiR" => "https://play.nim-lang.org/#pasty=vXSiJAvu"
02:44:19FromDiscord<.tokyovigilante> sent a long message, see https://pasty.ee/qeHdjlbE
02:45:47FromDiscord<.tokyovigilante> (sorry about the partial pastes)
02:46:31FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=vFNTeEWH
02:47:02FromDiscord<.tokyovigilante> But it turns out if I just skip the `include` indirection then this code will compile, which seems like it may actually be a compiler bug?
02:47:45FromDiscord<.tokyovigilante> ie if I delete `wayland_impl.nim` and just `import wayland_client_generated.nim` then it does compile.
02:48:53FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=sPsnxvwd
02:49:34FromDiscord<Elegantbeef> This is a Nim type bug you've found
02:49:35FromDiscord<Elegantbeef> How are you doing the include indirectin?
02:49:35FromDiscord<Elegantbeef> Why are you even including
02:50:02FromDiscord<Elegantbeef> change that to an import and be normal cheers πŸ˜„
02:52:41FromDiscord<Elegantbeef> I have very little faith in that `include` is what you want, no clue whether it fixes the bug though
02:52:55FromDiscord<Elegantbeef> I know for me I've used import over include for futhark generated code
02:53:07FromDiscord<Elegantbeef> But I also pretend `include` doesn't exist
02:54:44FromDiscord<.tokyovigilante> Fair, it does not fix the bug, but feels good to be normal πŸ™‚
02:56:42FromDiscord<.tokyovigilante> There is extra stuff in `wayland_impl` (mainly inline code which Futhark doesn't automatically bring in) which I omitted for brevity and I can reproduce the above without it
02:56:55FromDiscord<Elegantbeef> Do you have this in a repo?
03:00:32FromDiscord<.tokyovigilante> https://git.sr.ht/~tokyovigilante/Tsunami/
03:00:48FromDiscord<.tokyovigilante> Please don't laugh at my amateur coding skills
03:00:51FromDiscord<Elegantbeef> Thanks saves me making files
03:01:04FromDiscord<.tokyovigilante> That's the full app not the reproducible example
03:01:16FromDiscord<.tokyovigilante> I can share the test case alternatively
03:01:26FromDiscord<Elegantbeef> Too late
03:01:51FromDiscord<Elegantbeef> I'm already running your malware locally
03:02:05FromDiscord<.tokyovigilante> Isn't all Nim code malware?
03:02:14FromDiscord<Elegantbeef> Only the way you write it
03:03:12FromDiscord<Elegantbeef> `tsunami` is the entry file?
03:03:24FromDiscord<.tokyovigilante> yup
03:03:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=TMEuqKTd
03:04:48FromDiscord<.tokyovigilante> Yup, that's my issue, can't see how `ptr struct_wl_surface` and `ptr struct_wl_surface` are mismatched
03:06:02FromDiscord<Elegantbeef> Why are you importing using strings
03:06:02FromDiscord<Elegantbeef> Right different procedure as prior so thought I was not on the scent
03:07:06FromDiscord<Elegantbeef> Oh you're using code reorder aswell
03:07:20FromDiscord<Elegantbeef> Really throwing everything at the fun hell of diagnosing issues
03:07:48FromDiscord<.tokyovigilante> I thought we agreed you wouldn't make fun... maybe I do need to buy that book after all
03:07:59FromDiscord<.tokyovigilante> (furiously taking notes)
03:08:01FromDiscord<Elegantbeef> I mean I'm not making fun I'm trying to solve the issue πŸ˜›
03:08:17FromDiscord<Elegantbeef> code reordering is a compiler feature which could cause issues
03:08:55FromDiscord<.tokyovigilante> importing with strings for my local modules, unquote for system modules, sure I saw that somewhere...
03:09:25FromDiscord<Elegantbeef> Might be a status style guide, but i'm suspect of it myself
03:09:56FromDiscord<.tokyovigilante> Ah right. I could put my declarations first, LIKE AN ANIMAL. I did that before I got the codegen working for the Wayland stuff, while I was willy-nilly implementing functions to get a build going
03:10:26FromDiscord<Elegantbeef> Like a normal person that likes seeing what they're working with before other code
03:10:37FromDiscord<Elegantbeef> Even in a language with reordering I prefer declaration before usage so I know what's what. YMMV
03:14:06FromDiscord<Elegantbeef> Wait a minute `xdg_shell` uses `wayland_client_generated` even with `--d:useFuthark`?
03:15:32FromDiscord<.tokyovigilante> well... no. That's another temporary-ism, all the protocol extensions will need `wayland_client_generated` for some of the base protocol types so I just run a build with `--d:useFuthark` to generate that module, and then run a normal build which will include it where required.
03:15:47FromDiscord<.tokyovigilante> There is probably a better way to structure it
03:15:50FromDiscord<Elegantbeef> Well `include` would throw a wrench into that
03:16:00FromDiscord<Elegantbeef> So yea good thing you don't use include πŸ˜„
03:16:14FromDiscord<.tokyovigilante> In theory it should work with import in multiple places once generated though right?
03:21:43FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=KIYosWQd
03:21:52FromDiscord<ElegantBeef> Surely that slower me will catch up
03:22:09FromDiscord<ElegantBeef> in the mean time https://media.discordapp.net/attachments/371759389889003532/1349583282140086272/image.png?ex=67d3a0e0&is=67d24f60&hm=2db9b760037fbbf6e9712308ae296e83e3d2f257e1dd6c0878b8f2c29805fa5d&
03:22:51FromDiscord<ElegantBeef> It's looking a lot like you're getting two `struct _wl_display`s for one proc
03:23:11FromDiscord<Elegantbeef> Wait
03:23:12FromDiscord<Elegantbeef> bad copy
03:23:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=CikfLpPA
03:24:05FromDiscord<.tokyovigilante> I mean, my infrastructure is a leaning tower of issues... I'm using a packaged Nim and Nimble from the Alpine repo and I haven't quite figured out how to make that play nicely with nimple dependencies
03:24:20FromDiscord<ElegantBeef> Heh
03:24:50FromDiscord<.tokyovigilante> But yeah, presumably under the hood somewhere those two pointer types are different despite looking the same
03:25:08FromDiscord<ElegantBeef> You `import wayland_impl` and `wayland_client_generated`
03:25:59FromDiscord<ElegantBeef> When using futhark atleast this means the types are not compatible
03:26:16FromDiscord<ElegantBeef> Since one comes from `wayland_impl` and another from `wayland_client_generated`
03:27:03FromDiscord<ElegantBeef> https://status-im.github.io/nim-style-guide/language.import.html ah also status doesn't use strings in their style guide
03:27:10FromDiscord<ElegantBeef> So no clue where you got that from πŸ˜„
03:27:27FromDiscord<.tokyovigilante> ok, will consider myself told πŸ˜‰
03:39:28FromDiscord<ElegantBeef> @.tokyovigilante you've trolled me `xdg_shell` defines the type so does `wayland_client_generated`
03:39:58FromDiscord<ElegantBeef> Remove the def from `xdg_shell` and it suddenly works
03:41:30FromDiscord<Elegantbeef> I could've sworn that there was a time when types would print the module in output
03:43:58FromDiscord<.tokyovigilante> Ah I am an idiot. I think that was in before I realised I just needed to pull in the whole generated module. Then I even spent time not exporting those symbols thinking they would fix it, but of course they all still end up in the symbol table
03:44:06FromDiscord<.tokyovigilante> Thanks for the help, and the free code review!
03:45:12FromDiscord<.tokyovigilante> I will not quit my day job
03:45:47*rockcavera quit (Remote host closed the connection)
03:55:50*beholders_eye quit (Ping timeout: 260 seconds)
04:58:20*ensyde joined #nim
05:02:09*andreas quit (Quit: Konversation terminated!)
05:02:20*andreas joined #nim
05:36:35*ensyde quit (Quit: WeeChat 4.5.2)
06:18:35*ntat joined #nim
08:41:41FromDiscord<Zoom> @fromiselectq0 you were just unlucky and bumped into https://github.com/nim-lang/choosenim/issues/64↡↡Usually it works fine, but this bug is annoying and all the maintainers are busy with nimony. It's a bit annoying that nobody told you what's happening right away. GCC from 99 was funny, though.
08:45:07FromDiscord<fromiselectq0> In reply to @Zoom "<@552170338100969474> you were just": Ikr πŸ˜‚πŸ˜‚πŸ˜‚
08:45:26FromDiscord<fromiselectq0> It caught me off guard
10:14:52*ntat quit (Quit: Leaving)
10:18:01*beholders_eye joined #nim
10:30:35FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=MqbwMCEc
10:31:18FromDiscord<aintea> (edit) "https://play.nim-lang.org/#pasty=MptZhBBz" => "https://play.nim-lang.org/#pasty=eXjLyxnf"
10:31:23FromDiscord<aintea> Where `newParser` is the macro
10:49:01FromDiscord<demotomohiro> In reply to @aintea "I have no idea": There are tutorials for learning macros: https://internet-of-tomohiro.pages.dev/nim/faq.en#macro-is-there-any-tutorial-or-documents-to-learn-about-macroqmark
10:49:58*ntat joined #nim
11:12:43FromDiscord<solitudesf> In reply to @aintea "I have no idea": slap both of those into dumpTree and looks what you need to transform
11:19:22ehmrydumpTree is great. when I write a code generator I write an example of what I want by hand, put it thru dumpTree and then try to recreate it in code
11:21:44FromDiscord<aintea> In reply to @solitudesf "slap both of those": I've took a look at it but I have no idea how to start to write the parsing
11:21:57FromDiscord<aintea> In reply to @demotomohiro "There are tutorials for": Thanks
11:24:45ehmry.tokyovigilante: are you doing code generation?
11:26:14*ntat quit (Read error: Connection reset by peer)
11:32:30*ntat joined #nim
11:57:04FromDiscord<pmunch> In reply to @Zoom "<@552170338100969474> you were just": Not sure what the fix for this would be. I guess finding arch from the system and maybe trigger an error if GCC arch doesn't match?
11:57:25FromDiscord<pmunch> And you can create your own PRs to choosenim, be the change you want to see in the world πŸ˜„
12:18:36*ntat quit (Read error: Connection reset by peer)
12:26:20*ntat joined #nim
13:10:31FromDiscord<enthus1ast.> do we have a build in "getOrDefault" for openarray index access?
13:11:23FromDiscord<enthus1ast.> sent a code paste, see https://play.nim-lang.org/#pasty=wkVQqdJt
13:15:06FromDiscord<enthus1ast.> or, how would you write code that access an seq index where you do not know if the index is there?
13:24:50FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=qHzYRTHs
13:25:09FromDiscord<Robyn [She/Her]> that code should just work, no?
13:28:42FromDiscord<enthus1ast.> yes, but before i use it in my project i thought maybe i overlooked a build in
13:29:30Amun-Rass.len <= idx looks unorthodox
13:31:33FromDiscord<enthus1ast.> ?
13:32:16Amun-RaI mean it's just a yoda notation; btw you can use .high here instead
13:32:35Amun-Raif idx > ss.high: return default
13:33:09FromDiscord<enthus1ast.> yes high is better, i always forget that we have that
13:34:32Amun-Raand if that's inside a hot path of some kind, I'd thow "unlikely" in, too
13:34:55FromDiscord<enthus1ast.> not hot but why not
13:38:28FromDiscord<enthus1ast.> so just for the protocol, you're also not aware of a build in? πŸ™‚
13:47:02FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "and if that's inside": i don't think you should do that unless you actually profile your code tbh
13:47:21FromDiscord<Robyn [She/Her]> wouldn't just throw that around, compilers generally are pretty good at optimising
13:48:14*ntat quit (Quit: leaving)
13:52:46FromDiscord<enthus1ast.> since (plan) to use this code in js it will not matter
13:53:06FromDiscord<enthus1ast.> but i would benchmark it out of curiosity
14:25:46*ntat joined #nim
14:30:33FromDiscord<leorize> benchmarking JIT-able code is just a PITA
14:31:35FromDiscord<leorize> I'd recommend getting the whole program together then profile it to find bottlenecks instead of spending time on microbench
14:31:44Amun-RaRobyn: that depends on which occurance is more frequent, you can do that w/o the profiler
14:33:10FromDiscord<enthus1ast.> @leorize0713 i'm waaay before i care about benchmarks πŸ˜„ ↡I have thousands of lines in a big frontend.nim (karax) what works, does the job. But i now refactor and cleanup and modularize.
14:34:34FromDiscord<enthus1ast.> BUT if i would not have just "hack the stuff together" i would not have a "produkt" but would still think about the best/most elegant way of doing stuff
15:51:07*alexdaguy quit (Quit: ded)
15:57:48*ntat_ joined #nim
16:08:31FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "Robyn: that depends on": Why wouldn't you structure the branching code in that way then?
16:16:59*ntat_ quit (Quit: leaving)
16:38:02Amun-RaRobyn: let's say you read a file and you're just past the magic value and the next field according to the specs should be less than X; we can discuss whether it's a part of hot path; we don't have to profile the 99.9% of the files are according to the spec
16:44:04FromDiscord<Robyn [She/Her]> that doesn't really answer my question
16:44:21FromDiscord<Robyn [She/Her]> i'm saying why wouldn't you put the hot path/branch, first
16:47:55Amun-Rathat wasn't the part of the question before
16:48:52Amun-Rawhat I only mean was you don't have to use profiler to predict the branch
16:50:00FromDiscord<Robyn [She/Her]> In reply to @battery.acid.bubblegum "Why wouldn't you structure": ^^^
16:50:39FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "what I only mean": that's fair enough ig, but honestly I think restructuring code would be better than just slapping a `likely` or `unlikely` somewhere
16:56:51*pmp-p quit (Ping timeout: 252 seconds)
17:00:53*pmp-p joined #nim
17:38:30tokyovigilanteehmry: yup, I’ll share my wayland-scanner changes presently, will probably refactor it to be standalone ultimately though, it’s a bit clunky.
18:04:29FromDiscord<user2m> can I use -g directly like `nim c -g app.nim` ?
18:14:09FromDiscord<lainlaylie> seems undocumented but yes
18:27:16FromDiscord<nervecenter> what does it do?
18:39:43FromDiscord<user2m> > Use the nim c command to compile your Nim code, but include the -g flag to enable the inclusion of debug information
18:40:10FromDiscord<user2m> I have a memory leak and using valgrind and I think I need to pass -g
18:47:00FromDiscord<Elegantbeef> `--debugger:native`
19:15:45*beholders_eye quit (Ping timeout: 260 seconds)
19:31:09FromDiscord<leorize> I'd recommend LeakSanitizer/AddressSanitizer over valgrind
19:31:12FromDiscord<leorize> valgrind is just too slow for complex programs
19:31:13FromDiscord<Elegantbeef> I love trying to use valgrind with SDL games, it takes like 30 seconds to open a window
19:40:11Amun-Raasan/ubsan/etc.
19:40:40Amun-Raah, I missed the line mentioned those already
19:53:56FromDiscord<Elegantbeef> Slooooooow
20:24:46Amun-Ra;)
21:00:53FromDiscord<user2m> how can I update all my installed nim packages with nimble?
21:04:53FromDiscord<Elegantbeef> update your .nimble
21:06:24FromDiscord<user2m> In reply to @Elegantbeef "update your .nimble": Im not sure what you mean? I see the .nimble dir - how do I update this?
21:06:48FromDiscord<Elegantbeef> manually go to each dependency and copy the newest version
21:07:04FromDiscord<user2m> In reply to @Elegantbeef "manually go to each": ...theres no automatic way?
21:07:17FromDiscord<Elegantbeef> Not that I know of
21:07:43FromDiscord<Elegantbeef> A shell script could do it quickly
21:08:23FromDiscord<user2m> I found this https://forum.nim-lang.org/t/4648 just weird that it's not built in
21:08:47FromDiscord<Elegantbeef> "PRs welcome"
21:09:48*xet7 quit (Remote host closed the connection)
21:11:02FromDiscord<Elegantbeef> I don't think that works for packages not in your registry
21:11:40*xet7 joined #nim
21:13:46FromDiscord<user2m> yeah I only want to update the packages i've installed
21:14:17FromDiscord<Elegantbeef> Right but if you installed a package by giturl instead of by name it will fail to update it
21:18:07FromDiscord<user2m> yup I see that now lol
21:20:06FromDiscord<Elegantbeef> could use `nimble dump` and iterate the `requires`
22:05:54*ntat quit (Quit: Leaving)
22:23:59*rockcavera joined #nim
22:57:35*beholders_eye joined #nim
23:14:09*beholders_eye quit (Ping timeout: 260 seconds)
23:46:18*beholders_eye joined #nim