IRC channel logs

2024-05-29.log

back to list of logs

<old>when I geiser-eval-buffer inside a R6RS libray, I get the following error: unknown location: definition in expression context, where definitions are not allowed, in form (define (fuz) #t)
<old>any idea? I've never used the R6RS form before
<old>Odly I get the same thing trying to compile with compile-wasm
<sneek>dsmith: wb
<dsmith>sneek, botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been a process for one month and 20 days
<sneek>This system has been up 11 weeks, 13 hours, 2 minutes
<euouae>Hello, in SDL2, there's SDL_AddEventWatch taking a callback
<euouae>how can I use this function from Guile? Can Guile generate callbacks on the fly?
<euouae>e.g. if I wanted to pass a Guile lambda to it
<euouae>Looks like I need to write my own C procedure that converts Scheme source into a C function pointer
<old>euouae: Are you call SDL_AddEventWatch from C or from Guile FFI bindings?
<old>s/call/calling
<old>for the former: Use procedure->pointer in (use-modules (system foreign))
<old>However, you need to keep the procedure passed to procedure->pointer somewhere. Otherwise the GC will bite you
<euouae>I want to dynamically load SDL_AddEventWatch and call it with an argument from Guile
<euouae>let me try
<euouae>nice, thank you.
<euouae>I was worried I'd have to do something ugly...
<old>you might want to check SDL2 bindings: https://dthompson.us/projects/guile-sdl2.html
<old>also, I made this small example quickly: https://paste.sr.ht/~old/4f87855f84c041dd845eae74be513530f02500fc
<old>it is important to keep the scheme lambda somewhere. The GC won't protect it because the pointer object passed to C does not keep a reference back to it
<euouae>that project does not support SDL_AddEventWatch old
<euouae>It's what I was looking at. I was wondering how to add it in.
<euouae>btw I found a tiny wee lil bug in the doc page for procedure->pointer so we've successfully collaborated on fixing a bug today
<euouae>high-5!
<euouae>dang you whipped up that code real fast
<euouae>old: isn't it better to use guardians? (make-guardian)
<euouae>oh, the issue being order. nevermind
<euouae>old: just a nitpick, you'd probably want to sdl2-delete-event-watch and then hash-remove!
<lechner>Hi, is Guile expected to work flawlessly in a fully sanitized, zero environment?
<lechner>Hi, I think I have old duplicates in my GUILE_LOAD_PATH. Is there a way to show, from the runtime, the file paths of the modules that have been loaded?
<old>lechner: like what path module M is from?
<cow_2001>dthompson: (make-websocket "wss://andre.su") fails here :<
<cow_2001>In procedure getaddrinfo: Servname not supported for ai_socktype
<robjperez>cow_2001, out of curiosity I gave the websocket lib a try. It says I don't have gnutls module available. I'm pretty new to guile ecosystem, so I'm not sure what to do
<robjperez>saw that there is a fedora pacakge called guile-gnutls, but after installing it, i get the same error
<cow_2001>robjperez: :<
<old>sneek: later tell euouae you are right. The callback needs to be removed from SDL before removing the reference in Guile
<sneek>Will do.
<graywolf>Hm, how can I change the encoding for regexp-exec? I've tried (with-fluids ((%default-port-encoding ... but I am still getting "cannot convert narrow string to output locale" error. Any ideas?
<graywolf>My reading of the documentation is that is does not seem to be possible, but maybe I missed something...