Hi Klaus,

Klaus Stehle <[email protected]> skribis:

> (use-modules (srfi srfi-9))
>
> ;; A simple record definition for example
> (define-record-type my-record
>   (make-my-record one two)
>   my-record?
>   (one my-one)
>   (two my-two))
>
> ;; "Normal" construction is working well
> (define r1 (make-my-record "1" "2"))
>
> ;; This should also work, but it doesn't!
> (define r2 ((record-constructor my-record) "1" "2"))
> => ERROR

The use of ‘record-constructor’ above relies on a implementation detail
of the SRFI-9 implementation in Guile 1.8–namely, that SRFI-9 records
were implemented in terms of “Guile records” (info "(guile) Records").

In Guile 2.0, SRFI-9 records are no longer “Guile records”, so they no
longer have a “record-type descriptor” attached.  Thus,
‘record-constructor’ cannot be used with them.

Since you are using SRFI-9 anyway, I would recommend sticking to the
mechanisms specified by SRFI-9, thus avoiding ‘record-constructor’.

How would it work for you?

Thanks,
Ludo’.



Reply via email to