Subject: bug#11196: missing constructor procedure in new srfi-9 records

From: [email-masked] (Ludovic Courtès)
Date: Mon, 09 Apr 2012 23:21:09 +0200

Hi Klaus,

Klaus Stehle <[email-masked]> 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’.