GNU bug report logs -
#11196
missing constructor procedure in new srfi-9 records
Previous Next
Full log
View this message in rfc822 format
Hi Klaus,
Klaus Stehle <klaus.stehle <at> uni-tuebingen.de> 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’.
This bug report was last modified 13 years and 41 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.