<< 29-10-2024 >>

02:23:10*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in)
02:23:25*xutaxkamay joined #nim
03:29:37*lucasta quit (Quit: Leaving)
04:21:08FromDiscord<knakas> I’m relatively new to programming, but I’m curious could we do use nim to cross compile to Apple II using something like this? https://cc65.github.io/
04:44:06FromDiscord<James idowu Toyin> sent a long message, see https://pasty.ee/aHgSRmtR
05:45:30FromDiscord<arathanis> <@&371760044473319454>
06:13:27*ntat joined #nim
06:24:19*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
06:26:19*SchweinDeBurg joined #nim
07:33:39*ntat quit (Quit: Leaving)
08:42:06FromDiscord<arm_3_d> did someone try to use embedded wasm runtime? https://github.com/bytecodealliance/wasm-micro-runtime↵how hard it is to integrate into nim app?
08:43:01FromDiscord<Elegantbeef> I think I looked it it quite a while ago, it should be easy t wrap with futhark if there's a C-API
08:43:39FromDiscord<Elegantbeef> Personally I've just used wasm3 with https://github.com/beef331/wasm3 for my wasm tinkering
08:47:37FromDiscord<arm_3_d> @ElegantBeef thanks, didn't see that. Will check it out
08:48:36FromDiscord<Elegantbeef> My fancy stuff ontop of wasm3 is not well documented so at the very least you can use the underlying C-api
08:55:29*Artea joined #nim
08:57:45FromDiscord<nimaoth> @arm_3_d I started wrapping wasmtime a while a go, it's still WIP though: https://github.com/Nimaoth/nimwasmtime
08:58:37FromDiscord<arm_3_d> Thanks, that would help a lot
09:32:28ehmryis there a way to suppress exceptions for seq indexing? I want to use `if i < s.len: s[i]` in a `{.raises: [].}` proc
09:36:32ehmrynevermind, the compiler understands what `except: discard` does
09:37:08Amun-Rathat should work fine with raises:[] without any changes
09:37:20Amun-Ras[i] may generate only IndexDefect
09:38:48Amun-Rayou can push checks: off to disable index checks
09:39:24Amun-Rahttps://play.nim-lang.org/#pasty=TihzmolI
12:09:08FromDiscord<arnetheduck> In reply to @Amun-Ra "you can push checks:": checks: off with an invalid index will (eventually) lead to a memory fault due to an invalid memory access - it's not something you ever want to do
12:10:14FromDiscord<arnetheduck> In reply to @ehmry "nevermind, the compiler understands": `except: discard` is undefined behavior - per the manual, you cannot rely on `Defect` being caught always - but then again, `Defect` is also not part of `raises` analysis so you shouldn't have to do anything in particular
12:10:48ehmryyea, I don't want defect to be caught
12:11:27FromDiscord<arnetheduck> well, for `seq`, there's no raises tracking for `[]`
12:12:05Amun-Raarnetheduck: yes, but if that case it's fine
12:12:40FromDiscord<arnetheduck> (edit) "`[]`" => "`[]`, you can use it freely in `{.raises: [].}` and it'll raise that Defect right past the any raises annotations - in particular, on a negative `i` you'll hit a defect also 🙂"
12:12:46Amun-Ramemory fault in best case scenarion, undefined behavior in worst cast
12:13:00Amun-Ras/scenarion/scenario/
12:13:30Amun-Raif that's not a part of some hot code, I wouldn't turn limit checking off
12:18:24FromDiscord<demotomohiro> If you do bound checks `if i >= 0 and i < s.len:` before accessing the seq, bound check code in `s[i]` will be removed if you turn on optimization: https://internet-of-tomohiro.pages.dev/nim/nimruntimecheckoptimize.en#how-nim-s-runtime-checks-are-optimized-out-simple-openarray-read-with-an-index
12:18:44Amun-Raoh, nice
12:21:25FromDiscord<demotomohiro> GCC do optimization called jump threading: https://en.wikipedia.org/wiki/Jump_threading↵that removes redundant branches.
12:22:26ehmrythat's an entirely different thing from effect tracking and I wouldn't trust any of it to be stable
12:22:32Amun-Rathe check will stay in js target
12:24:48FromDiscord<gokr> Two things that bite me over and over: Somehow ending up with circular dependencies but... a) not realizing that is the problem (odd errors) and b) still confused how it happened (don't recall details now). And... I was beating my head against a "expression has no type" error for a long time, until I realized I had a discard in front of an expression that had no return value. Meh! I wonder if this is "just me" stuff. I realize I should let t
12:42:18FromDiscord<ayex> well, then you would get the false positives from the AI as tradeoff - not necessarily sure that is better.
12:48:51FromDiscord<gokr> Hehe, well. So far it has been very helpful though, amazed that it is so good at Nim actually (Sonnet 3.5, latest)
13:35:47*ntat joined #nim
13:48:20FromDiscord<double_spiral> Anyone know if futhark can bind structs and types? Or is it just for functions
14:35:16FromDiscord<spotlightkid> structs, yes, I'm sure. what other types do you mean? typedefs?
14:35:44FromDiscord<double_spiral> Yeah
14:36:00FromDiscord<double_spiral> How can i get the structs to work? I dont see any in the output
14:38:27FromDiscord<spotlightkid> I didn't have to do anything special. Can you share your wrapper code?
14:39:14FromDiscord<spotlightkid> Here's an example where I wrapped a C library, which has only two header files, the second included from the first\:↵https://github.com/SpotlightKid/nim-libsoundio/blob/master/src/soundio.nim
14:39:53FromDiscord<spotlightkid> And the generated Nim wrapper\: https://github.com/SpotlightKid/nim-libsoundio/blob/master/src/soundio_gen.nim
14:40:54FromDiscord<double_spiral> sent a code paste, see https://play.nim-lang.org/#pasty=tgySfCBI
14:41:18FromDiscord<double_spiral> sent a code paste, see https://play.nim-lang.org/#pasty=katTgBxc
14:48:59FromDiscord<spotlightkid> Well, I can't really try it without autobind.c. What 's the error message?
14:54:31FromDiscord<ayex> what would be the canonical way in nim,↵↵to implant an app\_icon.ico into a win executable?
14:55:31FromDiscord<double_spiral> sent a code paste, see https://play.nim-lang.org/#pasty=eEBHIhbs
14:55:42FromDiscord<double_spiral> And the issue is that the struct just doesnt get translated
14:55:58FromDiscord<double_spiral> (edit) "translated" => "translated/binded"
14:56:57*lucasta joined #nim
14:58:31FromDiscord<spotlightkid> @double_spiral\: https://github.com/PMunch/futhark?tab=readme-ov-file#hard-names-and-overrides↵You need a `struct_` prefix.
14:59:10FromDiscord<spotlightkid> i.e. the nim name is `struct_c_ExampleStruct`,
14:59:16FromDiscord<spotlightkid> i.e. the nim name is `struct_c_ExampleStruct`.
15:01:48FromDiscord<double_spiral> I tried this and nim didnt see it. I believe my issue at this point is that it doesnt exist in the futhark output
15:02:07FromDiscord<double_spiral> sent a code paste, see https://play.nim-lang.org/#pasty=WKvEswRP
15:04:26FromDiscord<spotlightkid> It does here\: https://cpaste.org/?802b56d4d3bc1ea0#DmGbCCsXqvQAvPi9JYYNL6jDNJj83KzGKk9ryViataJU
15:04:34FromDiscord<spotlightkid> Nim version? futhark version?
15:05:03FromDiscord<double_spiral> Latest for both
15:05:08FromDiscord<double_spiral> Ill try clearing the cache
15:06:01FromDiscord<double_spiral> Oh that was the issue
15:06:07FromDiscord<double_spiral> Thanks for the help
15:07:23FromDiscord<spotlightkid> Yeah, I usually always clean the cache when using futhark. For example it doesn't invalidate the cache when the rename callback changes.
16:15:38FromDiscord<emanresu3> how can I see the value of a string variable in gdb? When I do `p x` it shows ` $1 = <optimized out>`. I'm compiling with `nim --lineDir:on --debuginfo --d:debug --debugger:native`
17:09:43*lucasta quit (Quit: Leaving)
17:52:02FromDiscord<demotomohiro> Did you use `nim-gdb`? https://github.com/nim-lang/Nim/blob/devel/bin/nim-gdb
18:14:26FromDiscord<emanresu3> no, first I heard of it. I'll try it
18:26:40Amun-Raif you compiled nim from source, you have nim-gdb already in bin directory
18:31:50FromDiscord<emanresu3> sent a code paste, see https://play.nim-lang.org/#pasty=DEUNjDwD
18:52:56FromDiscord<bubbly_avocado_86424> sent a long message, see https://pasty.ee/apDkZsKI
18:53:06FromDiscord<bubbly_avocado_86424> (edit) "https://pasty.ee/sEeHnkmh" => "https://pasty.ee/KsbOtwVE"
18:53:31FromDiscord<Elegantbeef> `myJsonNode[0]`
18:53:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ftihEuZY
19:01:42FromDiscord<tauruuuuuus> Soooo can macros be overloaded?
19:01:49FromDiscord<bubbly_avocado_86424> hmm, well, yes↵works for JsonNode indeed
19:01:55FromDiscord<tauruuuuuus> I think I wasted the last hour of my life with cryptic errors because of this
19:05:11FromDiscord<tauruuuuuus> That's the only one thing I really dislike about nim, the errors can be a bit out of this world sometimes
19:06:21FromDiscord<bubbly_avocado_86424> In reply to @tauruuuuuus "That's the only one": the errors can indeed be challenging when learning Nim, i'm also no fan of forced indentation really↵style is a choice and a discipline, not something to enforce the hard way
19:07:11FromDiscord<tauruuuuuus> The more I use it the more I don't dislike the indentation think tbh, but I never had any problems with it
19:07:21FromDiscord<tauruuuuuus> (edit) "more" => "less" | removed "don't"
19:07:36FromDiscord<Elegantbeef> Yesn't↵(@tauruuuuuus)
19:07:57FromDiscord<Elegantbeef> You cannot overload an untyped macro as overloading requires typing
19:08:06FromDiscord<tauruuuuuus> In reply to @Elegantbeef "Yesn't (<@375951998337417229>)": LOL
19:08:21FromDiscord<Elegantbeef> Atleast you cannot overload parameter types, you can overload arity
19:08:23FromDiscord<bubbly_avocado_86424> In reply to @tauruuuuuus "The more I use": i appreciate indentation to be configurable, haven't checked if it can be set to my own size
19:08:39FromDiscord<tauruuuuuus> In reply to @Elegantbeef "You cannot overload an": oooooh nice nice, chatgpt just thought you couldn't
19:09:14FromDiscord<Elegantbeef> Well good thing we do not rely on chatgpt and just check using a compiler
19:10:22FromDiscord<tauruuuuuus> Yup, but when the compiler error does not tell you that, it's nice to have an AI companion reassuring you lol
19:10:43FromDiscord<Elegantbeef> Except the AI companion doesn't know anything
19:10:50FromDiscord<Elegantbeef> So it's just gas lighting yourself
19:10:55FromDiscord<tauruuuuuus> I'm fine with that
19:11:04FromDiscord<tauruuuuuus> LOL
19:11:17FromDiscord<tauruuuuuus> Jokes aside, thanks for the info
19:11:40FromDiscord<tauruuuuuus> I actually started using chatgpt more as a google search because of nim errors lately
19:11:40FromDiscord<bubbly_avocado_86424> i like lighting gas ↵does that exempt me ?
19:11:55FromDiscord<emanresu3> AI knows as much as information is on the internet, there isn't as much on Nim as with other languages
19:12:12FromDiscord<bubbly_avocado_86424> In reply to @emanresu3 "AI knows as much": i actually like that most of the time
19:13:37FromDiscord<tauruuuuuus> Yeah folks, I'm just using it as a gathering info tool to then make a more in-depth search
19:13:53FromDiscord<tauruuuuuus> Nothing crazy, but coming back to the macro thing
19:14:34FromDiscord<tauruuuuuus> sent a code paste, see https://play.nim-lang.org/#pasty=ZyGGHyiL
19:14:39FromDiscord<tauruuuuuus> (edit) "https://play.nim-lang.org/#pasty=vnxaZkHU" => "https://play.nim-lang.org/#pasty=kpbvhbEw"
19:15:16FromDiscord<tauruuuuuus> Then now I can do something like overloading a template that then calls the macro with different args? The compiler does not give me problems but I wonder if it's ok
19:15:32FromDiscord<Elegantbeef> Well yea aslong as the overloads are all of the same typeness
19:15:42FromDiscord<Elegantbeef> If you attempt to overload `untyped` you're going to not be able to
19:16:04FromDiscord<tauruuuuuus> I'll give you a snippet to get an opinion
19:18:00FromDiscord<tauruuuuuus> sent a code paste, see https://play.nim-lang.org/#pasty=vSqIVgWL
19:18:17FromDiscord<Elegantbeef> You're overloading untyped
19:18:21FromDiscord<tauruuuuuus> I wrote this and it seems to work correctly, if I use one or the other, I just want to know if it's supposed to
19:18:45FromDiscord<tauruuuuuus> Mmm ok, my fear is this works now but maybe it's because of "luck"
19:18:49FromDiscord<Elegantbeef> You're not going to be able to use `template isr(v: static VectorInterrupt, p: untyped): untyped = `
19:19:19FromDiscord<Elegantbeef> To dispatch you need to type the 2nd parameter and that means `p` has to be typed
19:19:25FromDiscord<tauruuuuuus> you're right
19:19:46FromDiscord<tauruuuuuus> this is the final macro thing to learn in nim for me
19:19:52FromDiscord<Elegantbeef> I'm something of a compiler myself
19:20:07FromDiscord<tauruuuuuus> the typed vs untyped thingie, I get it from a high level perspective but I lack the intuition
19:20:21FromDiscord<tauruuuuuus> In reply to @Elegantbeef "I'm something of a": I hope you're not a c++ one kind sir..
19:20:45FromDiscord<Elegantbeef> Certainly not just a large stupid model for a Nim compiler
19:23:02FromDiscord<tauruuuuuus> lol I just switched to `typed` as the last parameter for both macro and templates and it works
19:23:06FromDiscord<tauruuuuuus> Was it that easy?
19:23:32FromDiscord<Elegantbeef> I mean it shouldn't matter if `p: untyped` can be untyped
19:23:53FromDiscord<tauruuuuuus> I guess I don't get the difference in general
19:24:17FromDiscord<Elegantbeef> If the code compiles whilst parsing and semantically analysing `p` then it's fine
19:24:18FromDiscord<tauruuuuuus> I remember a discussion where Araq was pointing out that untyped should essentialy be deprecated tho
19:24:26FromDiscord<Elegantbeef> If you did not want it to analyse `p` you'd have issues
19:25:03FromDiscord<tauruuuuuus> Could you give me one example where I would not want that?
19:25:08FromDiscord<tauruuuuuus> Just for my sanity/clarity
19:25:24FromDiscord<Elegantbeef> It's a whole massive change
19:25:24FromDiscord<Elegantbeef> Yes he wants to make it so the compiler always attempts to analyse code and emit `nnkOpenSym`s instead of needing `untyped`
19:26:08FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=TNLjfnRA
19:26:32FromDiscord<Elegantbeef> This does not compile cause `echo it` needs to be typed to see if it matches `doThing(val: int)`
19:27:02FromDiscord<Elegantbeef> @bubbly_avocado_86424 you can ask that question here
19:27:36FromDiscord<bubbly_avocado_86424> sent a long message, see https://pasty.ee/dOgisbby
19:28:14FromDiscord<tauruuuuuus> sent a code paste, see https://play.nim-lang.org/#pasty=zfcYzQzK
19:28:17FromDiscord<tauruuuuuus> Thanks so much
19:28:18FromDiscord<Elegantbeef> It surely should
19:29:07FromDiscord<Elegantbeef> That was to the json question
19:30:02FromDiscord<Elegantbeef> And to the indention comment you made in passing, install indention rainbows and or enable indention lines
19:33:28FromDiscord<bubbly_avocado_86424> ah, wuuut, i need to insert a space to print↵echo "myvar", myvar,myvar.kind↵echo "myvar", myvar, myvar.kind
19:33:34FromDiscord<jm_sts> In reply to @tauruuuuuus "the typed vs untyped": Untyped lets you do somewhat illegal syntax but without tooling support
19:34:57FromDiscord<Elegantbeef> No you do not need to insert that space
19:35:38FromDiscord<Elegantbeef> Well I'd not say illegal syntax, but yes
19:35:44FromDiscord<Elegantbeef> If it's illegal syntax it does not parse
19:36:05FromDiscord<bubbly_avocado_86424> not sure what i did wrong but now it works, sigh
19:36:19FromDiscord<bubbly_avocado_86424> i'm starting to think computers are emerging sentience
19:36:22FromDiscord<Elegantbeef> Did you perhaps have `echo"...."`?
19:36:25FromDiscord<bubbly_avocado_86424> or me losing sentience
19:36:37FromDiscord<bubbly_avocado_86424> nope, i don't think so
19:36:38FromDiscord<Elegantbeef> Cause `echo""` is different from `echo ""`
19:36:53FromDiscord<Elegantbeef> Well then you are purposely throwing a wrench in your progress
19:37:09FromDiscord<bubbly_avocado_86424> hmmm
19:37:15FromDiscord<bubbly_avocado_86424> makes sense
19:37:24FromDiscord<bubbly_avocado_86424> going back i don't see much difference
19:41:34FromDiscord<bubbly_avocado_86424> i think i was trying out too much on one line and this interfered↵i'm just an average joe, not a math genius
19:47:13FromDiscord<jm_sts> In reply to @Elegantbeef "If it's illegal syntax": Right, like it still needs to create a valid AST
19:50:38*coldfeet joined #nim
20:03:51FromDiscord<bubbly_avocado_86424> does nim have something like quit or break or exit to end the program ?
20:05:34FromDiscord<griffith1deadly> In reply to @bubbly_avocado_86424 "does nim have something": https://nim-lang.org/docs/system.html#quit%2Cint
20:27:14FromDiscord<bubbly_avocado_86424> sent a long message, see https://pasty.ee/WYjOUIDH
20:27:48FromDiscord<Elegantbeef> `readFile` is relative to the current working directory `staticRead` is relative to the nim module
20:28:13*coldfeet quit (Remote host closed the connection)
20:28:49FromDiscord<bubbly_avocado_86424> ow, that's a bit odd, would be welcome to see that in the doc↵https://nim-lang.org/docs/system.html#staticRead
20:31:19FromDiscord<bubbly_avocado_86424> ehm, pretty cool, so now i have the .json written inside of the binary
21:03:37*ntat quit (Quit: Leaving)
21:26:20FromDiscord<gokr> Been fiddling trying out LLDB vs GDB in vscode and using the nimlldb.py script that now is included in Nim. Lots of room for improvement 🙂
21:26:39FromDiscord<gokr> Seems there are multiple forks of nimlldb.py around too
22:54:25*m5zs7k_ joined #nim
22:55:17*m5zs7k quit (Ping timeout: 265 seconds)
22:58:58*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
23:02:51*m5zs7k_ is now known as m5zs7k
23:07:48*gshumway quit (Quit: .)
23:12:00*gshumway joined #nim
23:28:16FromDiscord<knakas> Is there a bounty board?
23:30:16FromDiscord<knakas> If not the idea would be for paid nim work. Like do this thing I want, I’ll seed the bounty with X $$. If that’s enough for some one to do then it’s enough but more than one person can contribute to a bounty. (I want Apple II support but county commit to a large bounty.)
23:30:28FromDiscord<knakas> (edit) "county" => "could not"
23:32:38*lucasta joined #nim
23:37:53*Lord_Nightmare joined #nim
23:44:00FromDiscord<.bobbbob> not dismissing your bounty idea but I really doubt nim can run on an apple ii, nim needs certain things from the c library like malloc to compile and even then nim would be way to heavy to run on the 6502
23:49:08FromDiscord<Elegantbeef> It's best to just spend the time and see how far you can get 😄