unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Use of foreign objects to wrap anything other than an integer
@ 2020-05-25 22:04 divoplade
  2020-05-25 22:10 ` divoplade
  0 siblings, 1 reply; 2+ messages in thread
From: divoplade @ 2020-05-25 22:04 UTC (permalink / raw)
  To: guile-user

Hello,

How do I use the foreign object type?

When I do:

(use-modules (system foreign-object))
(use-modules (oop goops))
(define-foreign-object-type <thing> make-thing (x) #:finalizer (lambda
(x) #t))
(make-thing "hello")

I get:
ERROR: In procedure struct-set!/unboxed:
Wrong type (expecting exact integer): "hello"

I thought it might be some kind of a bug, but it is the same thing for
3.0.2, 2.2.7 and 2.2.4 (guix) and 2.2.4 (debian).  2.2 is the first to
introduce the foreign objects.

How should I do it?

divoplade




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Use of foreign objects to wrap anything other than an integer
  2020-05-25 22:04 Use of foreign objects to wrap anything other than an integer divoplade
@ 2020-05-25 22:10 ` divoplade
  0 siblings, 0 replies; 2+ messages in thread
From: divoplade @ 2020-05-25 22:10 UTC (permalink / raw)
  To: guile-user

OK, nevermind, I did not understand correctly how it worked.

Le mardi 26 mai 2020 à 00:04 +0200, divoplade a écrit :
> Hello,
> 
> How do I use the foreign object type?
> 
> When I do:
> 
> (use-modules (system foreign-object))
> (use-modules (oop goops))
> (define-foreign-object-type <thing> make-thing (x) #:finalizer
> (lambda
> (x) #t))
> (make-thing "hello")
> 
> I get:
> ERROR: In procedure struct-set!/unboxed:
> Wrong type (expecting exact integer): "hello"
> 
> I thought it might be some kind of a bug, but it is the same thing
> for
> 3.0.2, 2.2.7 and 2.2.4 (guix) and 2.2.4 (debian).  2.2 is the first
> to
> introduce the foreign objects.
> 
> How should I do it?
> 
> divoplade
> 
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-25 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 22:04 Use of foreign objects to wrap anything other than an integer divoplade
2020-05-25 22:10 ` divoplade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).