<< 15-06-2025 >>

01:17:37*beholders_eye quit (Ping timeout: 248 seconds)
03:41:55*nils` quit (Ping timeout: 276 seconds)
04:34:59*alexdaguy joined #nim
05:01:05*nils` joined #nim
05:16:45FromDiscord<lainlaylie> same as when you want a normal case statement branch that does nothing. though maybe this warrants explicit mention in the manual
07:21:48*alexdaguy quit (Read error: Connection reset by peer)
09:17:58*derpydoo joined #nim
09:19:42*jjido joined #nim
09:46:04*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
09:48:41*przmk4 joined #nim
10:02:33*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
10:05:01*przmk4 joined #nim
10:06:49*derpydoo quit (Quit: derpydoo)
10:27:25*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
10:32:11*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
10:34:39*przmk4 joined #nim
10:42:22*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
10:44:52*przmk4 joined #nim
11:09:00*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
11:11:26*przmk4 joined #nim
11:28:06*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
11:30:34*przmk4 joined #nim
11:35:32*przmk4 quit (Quit: The Lounge - https://thelounge.chat)
11:38:04*przmk4 joined #nim
11:41:55*przmk joined #nim
11:54:49*socrates1298 joined #nim
11:56:49*socrates1298 quit (Client Quit)
12:46:18FromDiscord<starkiller1493> Is there a way to make the debugger in vscode not enter Nim std?
12:47:22FromDiscord<starkiller1493> (edit) "not" => "never"
13:08:45FromDiscord<litlighilit> I may haven't overall understand your question, but maybe just `cast[proc (res: ptr gcc_jit_result, funcname: cstring)](xxx)`?↵(<@709044657232936960_=47uest32=5b=49=52=43=5d>)
13:09:06FromDiscord<litlighilit> I may haven't overall understand your question, but maybe just `cast[proc (res: ptr gcc_jit_result, funcname: cstring){.cdecl.}](xxx)`?
13:11:35*Guest32-again joined #nim
13:12:05FromDiscord<litlighilit> assuming you've alreadly importc a `gcc_jit_result` object type.
13:16:22Guest32-againSo, to clarify, I can call `git_jit_result_get_code` with no issues. This produces a void*, pointing to a newly created function I want to invoke from Nim.
13:16:23Guest32-againIt's just that I don't know there's a neat way to invoke this.
13:16:23Guest32-againCode for context:
13:16:24Guest32-again```
13:16:24Guest32-again  let
13:16:25Guest32-again    res = jitCtxCompile(ctx)
13:16:25Guest32-again    # I can successfully call jitResultGetCode (gcc_jit_result_get_code):
13:16:26Guest32-again    # This returns a bare C function pointer, as a void*.
13:16:26Guest32-again    code: pointer = jitResultGetCode(res, cstring("main"))
13:16:27Guest32-again    # Then, I just want to call this pointer from Nim.
13:16:27Guest32-again    # Hacky C trampoline that works:
13:16:28Guest32-again    # I just pass the raw void* code pointer to a C function to do the calling for me.
13:16:28Guest32-again    fn = (argc: int, argv: ptr ptr char) => invokeTrampoline(code, cint(argc), argv)
13:16:29Guest32-again  fn(0, nil)
13:16:29Guest32-again```
13:17:04Guest32-againWow that's horrible let me paste in discord.
13:17:39FromDiscord<syrupsy> sent a code paste, see https://play.nim-lang.org/#pasty=lrVWLhSx
13:58:51*Guest32-again quit (Quit: Ping timeout (120 seconds))
14:06:39FromDiscord<litlighilit> `cast[proc (argc: cint, argv: ptr cstring): cint{.cdecl.}](code)`↵?
14:06:54FromDiscord<litlighilit> `let fn = cast[proc (argc: cint, argv: ptr cstring): cint{.cdecl.}](code)`↵?
14:07:20FromDiscord<litlighilit> sent a code paste, see https://play.nim-lang.org/#pasty=vPYNDKiA
14:23:37FromDiscord<syrupsy> This works great!
14:23:59FromDiscord<syrupsy> For some reason this does result in non-gcsafe code, but I can work around that.
14:24:56FromDiscord<syrupsy> Thanks!!
14:44:06Amun-Raproc (argc: cint, argv: ptr cstring): cint{.cdecl.} better signature is proc (argc: cint, argv: cstringArray): cint{.cdecl.}
14:44:35Amun-RaI mean if you need to access elements of argv
14:44:53Amun-Raif not, even argv: pointer will suffice
15:05:14*skippy8 joined #nim
15:07:36FromDiscord<syrupsy> This is now just a matter of curiosity, but is there any reason this cast causes the function it's in to be non-gcsafe? ↵Complete guess, but is this cast heap allocating a thunk..?
15:42:28*jjido joined #nim
15:48:57FromDiscord<lainlaylie> isn't it just that proc type are not assumed to be gcsafe
15:58:00*ntat joined #nim
16:09:30*UroborosQ joined #nim
16:09:42*UroborosQ quit (Client Quit)
16:21:05FromDiscord<leorize> gcsafe is mostly an obsolete attribute
16:22:15FromDiscord<Robyn [She/Her]> Is it feasible to track if something is gcsafe in Nim, in the first place?
16:22:32FromDiscord<Trayambak> No, I think it's for side effects↵(@lainlaylie)
16:22:52FromDiscord<Robyn [She/Her]> In reply to @Trayambak "No, I think it's": huh?
16:23:43FromDiscord<Robyn [She/Her]> I'm p sure Laylie is right here, usually the compiler tries to infer if a proc is gcsafe, but if you cast a pointer to a proc type, compiler can't analyse anything
16:24:03FromDiscord<leorize> > We call a proc p GC safe when it doesn't access any global variable that contains GC'ed memory (string, seq, ref or a closure) either directly or indirectly through a call to a GC unsafe proc.↵from the manual
16:28:06FromDiscord<Robyn [She/Her]> ahh
16:28:23FromDiscord<Robyn [She/Her]> my bad for thinking the compiler was that smart :P
16:30:02FromDiscord<lainlaylie> er, if you add {.gcsafe.} to the proc type, it becomes callable from a gcsafe proc
16:30:39FromDiscord<lainlaylie> opinions on the value of nim's concept of gc safety is another matter
16:47:58FromDiscord<leorize> gcsafe mainly exists because nim gc cannot deal with heap memory across threads
16:48:19FromDiscord<leorize> and the biggest user of this is asyncdispatch
16:48:45FromDiscord<leorize> where last I checked, it's added so that asyncdispatch could use threads in the future, but never did
17:39:55*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
17:48:23*beholders_eye joined #nim
17:48:40*jjido joined #nim
17:52:53*rez quit (Quit: much snoozes...)
18:17:14*beholders_eye quit (Ping timeout: 268 seconds)
19:16:33FromDiscord<eugaming> sent a code paste, see https://play.nim-lang.org/#pasty=MtBuOMLr
19:18:02FromDiscord<leorize> string concat operator is `&` in nim, not `+`
19:18:37FromDiscord<eugaming> oh lmao now i see what they ment with type missmatch that compiler error is kinda missleading lmao thx ai bot
19:19:17FromDiscord<eugaming> or IRC idk atleast thx
19:20:40FromDiscord<Elegantbeef> It's not really misleading, there are no matches for `string + string` so it's a type mismatch
19:23:48FromDiscord<leorize> technically the truth, but unhelpful all the same
19:23:48FromDiscord<Elegantbeef> Hey no solution in an adhoc language!
19:23:49FromDiscord<leorize> lmao
19:28:43FromDiscord<DetermiedNim1> Is it possible to compile a nim program without c stdlib
19:38:30FromDiscord<leorize> nope
19:38:58FromDiscord<leorize> you need at least basic C98 facilities to be available
19:50:01*ntat quit (Quit: leaving)
20:08:24FromDiscord<demotomohiro> In reply to @determiedmech1 "Is it possible to": possible: https://github.com/demotomohiro/MinimumNimPico
20:12:46FromDiscord<DetermiedNim1> In reply to @leorize "you need at least": Dang
20:13:09FromDiscord<DetermiedNim1> In reply to @demotomohiro "possible: https://github.com/demotomohiro/MinimumNi": Hopefully Pico-8 is similar to a risc-v emulator made using mindustry processord
20:13:18FromDiscord<DetermiedNim1> (edit) "In reply to @demotomohiro "possible: https://github.com/demotomohiro/MinimumNi": Hopefully Pico-8 is similar ... toprocessors" added "enought" | "processord" => "processors"
20:13:54FromDiscord<Elegantbeef> Pico is not pico8 😄
20:14:15FromDiscord<DetermiedNim1> That was a typo
20:14:27FromDiscord<Elegantbeef> Pico is an arm microcontroller so not too dissimilar to targeting risc-v
20:14:37FromDiscord<DetermiedNim1> (edit) "Pico-8" => "this"
20:14:38FromDiscord<DetermiedNim1> https://github.com/object-Object/mlogv32
20:14:51FromDiscord<DetermiedNim1> In trying to compile a program for this
20:39:41*beholders_eye joined #nim
20:58:07*beholders_eye quit (Ping timeout: 244 seconds)
21:22:28*beholders_eye joined #nim
22:21:14*beholders_eye quit (Ping timeout: 260 seconds)
23:29:26*skippy8 quit (Quit: WeeChat 4.6.3)
23:32:48*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
23:42:02FromDiscord<heysokam> lets say I have a C struct `Thing` that has both a `Thing_create()` and `Thing_destroy()` functions in the C code, that do alloc/free their own data from the C side↵How would I connect them on the Nim side with the GC, so that they are automatically managed by it?