[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble creating SRFI-9 Record in C

From: Matt Wette
Subject: Re: Trouble creating SRFI-9 Record in C
Date: Sat, 11 Sep 2021 06:30:42 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

maybe add

(define (make-foo-x a b) (make-foo a b))

then call make-foo-x (or reverse names)

On 9/10/21 7:27 PM, paul wrote:
Good day guile-users,

I am having a struggle with SRFI-9 records.  They look very convenient, so i'd like to use them in my Guile scripts.  However, i'm not sure how to correctly construct them from C-land.  I have something like the following:

(define-record-type <foo>
 (make-foo a b)
 (a foo-a)
 (b foo-b))

In Guile land, that works great.  Now, i want to create a foo in C and pass it to a function in the Guile script.  I do something like the following:


However, this results in an error:

guile: uncaught exception:
Wrong type to apply: #<syntax-transformer make-foo>

I've tried with and without (define-module foo) at the top of the file, that doesn't seem to make a difference.  I've been able to work around the issue by defining a wrapper (define (foo-prime a b) (make-foo a b)) and using that in C as shown above, but that feels ugly.  I'm probably missing something obvious, but trawling the mailing list didn't turn up anything i could understand.

Does anyone see what i'm doing wrong, or can i simply not use SRFI-9 records in this way?

Thanks, 🙌

reply via email to

[Prev in Thread] Current Thread [Next in Thread]