IRC channel logs

2024-08-18.log

back to list of logs

<cpli>lilyp when using optional arguments it can get kind of messy. i.e. (define* (f #:optional arg1 #:key #:allow-other-keys #:rest args) ... i can't emulate that behavior with just (f . args) q-q
<sneek>Welcome back chrislck!
<cpli>re: guile package manager, wingo also has a post on dorodango https://www.wingolog.org/archives/2011/07/04/guile-2-0-2-building-the-guildhall
<haugh>cpli, are you familiar with parameters? Couldn't find the root of your issue but if you're getting frustrated passing settings down through nested layers of invocations, that's a principle application of dynamic scope.
<lilyp>cpli (f #:optional a b c #:rest rest) ?
<dsmith>13 years of guildhall? What happened? Or rather, didn't?
<ekaitz>Hi! can i introduce a pointer in a foreign-object defined with define-foreign-object-type?
<ekaitz>i'm having trouble with that
<ekaitz>with an example: https://paste.debian.net/1326767/
<ekaitz>I'm getting:
<ekaitz>ERROR: In procedure struct-set!/unboxed:
<ekaitz>Wrong type (expecting exact integer): #<pointer 0x583940>
<mwette>ekaitz: I'm not sure, but reading the documentation it seems all the slots should be (foreign) pointers.
<ekaitz>mwette: hmm but my g-variant-* functions are also foreign functions
<ekaitz>maybe their return value is a wrapped pointer and that's not allowed?
<ekaitz>should i pointer-address ?
<mwette>Are you saying g-variant-new-int is not accepting an integer argument?
<mwette>I'm guessing (g-variant-new-int 5) => pointer, right?
<ekaitz>yes (g-variant-new-int 5) => pointer
<ekaitz>yes
<ekaitz>but the pointer is a wrapped one
<ekaitz>like the ones coming from a foreign-function
<mwette>It's wrapped by glib.
<mwette>You'd need to call g-variant-get-int to fetch its value, I guess.
<ekaitz>no, because i need the variant
<ekaitz>i mean, the variant should be the pointer i send
<ekaitz>i need to send the variant to some function later
<ekaitz>and it should get the internal value later
<mwette>Ah, now I see what you are doing. Looks like it should work.
<mwette>Are you generating foreign object types in the g-* functions?
<ekaitz>mwette: let me upload all this somewhere so i can show you
<ekaitz> https://github.com/ekaitz-zarraga/guile-libnotify/blob/master/notify/internal.scm
<ekaitz>make-g-variant is what doesn't work well
<ekaitz>i tried to use pointer-address and that works there but other things explode
<ekaitz>i don't think that's expected
<mwette>My guess is that using pointers is correct: could be a bug in Guile.
<ekaitz>:(
<ekaitz>thanks for the help mwette
<ekaitz>mwette: oh wait, i think I have something working!
<ekaitz>mwette: i had to wrap and unwrap the pointers
<ekaitz> https://github.com/ekaitz-zarraga/guile-libnotify/commit/3e193f1814bd5570a389c1147d636cb6a6c12d62
<mwette>Ah. OK. I found (something like) this in foreign-object.c: scm_foreign_object_ref(obj) { return scm_foreign_object_unsigned_ref(obj); }
<ekaitz>i also found that (case ...) when being used with symbols always says cases are duplicated
<ekaitz>:S
<mwette>bizzare