unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: divoplade <d@divoplade.fr>
To: guile-user@gnu.org
Subject: Use of foreign objects to wrap anything other than an integer
Date: Tue, 26 May 2020 00:04:18 +0200	[thread overview]
Message-ID: <6e359810021ed654dd38e72017e07d5b4b88ba38.camel@divoplade.fr> (raw)

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




             reply	other threads:[~2020-05-25 22:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 22:04 divoplade [this message]
2020-05-25 22:10 ` Use of foreign objects to wrap anything other than an integer divoplade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6e359810021ed654dd38e72017e07d5b4b88ba38.camel@divoplade.fr \
    --to=d@divoplade.fr \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).