unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Klaus Stehle <klaus.stehle@uni-tuebingen.de>
Cc: 11196@debbugs.gnu.org
Subject: bug#11196: missing constructor procedure in new srfi-9 records
Date: Mon, 09 Apr 2012 23:21:09 +0200	[thread overview]
Message-ID: <87bon0a9fe.fsf@gnu.org> (raw)
In-Reply-To: <Pine.LNX.4.61.1204072149420.6107@commlink.zdv.uni-tuebingen.de> (Klaus Stehle's message of "Sat, 7 Apr 2012 21:54:34 +0200 (CEST)")

Hi Klaus,

Klaus Stehle <klaus.stehle@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’.





  reply	other threads:[~2012-04-09 21:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07 19:54 bug#11196: missing constructor procedure in new srfi-9 records Klaus Stehle
2012-04-09 21:21 ` Ludovic Courtès [this message]
2012-04-09 22:19 ` Ludovic Courtès

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=87bon0a9fe.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=11196@debbugs.gnu.org \
    --cc=klaus.stehle@uni-tuebingen.de \
    /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).