Subject: Re: bug#66268: Guix makes invalid assumptions regarding guile-git guarantees leading to guix pull failing

From: Ludovic Courtès <[email-masked]>
Date: Tue, 01 Apr 2025 09:53:29 +0200

Hi,

Tomas Volf <[email-masked]> skribis:

> However on my first (and second) reading of the documentation I did not
> get it, and expected eq? in the below snippet to return #f (since the
> pointer being wrapped does equal? to itself).  So maybe I am missing
> something else as well.
>
> scheme@(guile-user)> ,use (system foreign)
> scheme@(guile-user)> ,use (system foreign-library)
> scheme@(guile-user)> (define-wrapped-pointer-type foo foo? wrap-foo unwrap-foo #t)
> scheme@(guile-user)> (define-wrapped-pointer-type bar bar? wrap-bar unwrap-bar #t)
> scheme@(guile-user)> (define open* (foreign-library-function #f "open"))
> scheme@(guile-user)> (wrap-foo open*)
> $8 = #<foo 7fec7aac1010>
> scheme@(guile-user)> (wrap-bar open*)
> $9 = #<bar 7fec7d3dd510>
> scheme@(guile-user)> (eq? $8 $9)
> $10 = #f
> scheme@(guile-user)> (equal? open* open*)
> $12 = #t

<foo> and <bar> are different data types, so no wonder $8 and $9 are not
eq?.

What this means is that, given a pointer P, (eq? (wrap-foo p) (wrap-foo p))
is always true.

HTH!

Ludo’.