[Top][All Lists]

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

Re: Unintentional conflict in define-immutable-type?

From: Ludovic Courtès
Subject: Re: Unintentional conflict in define-immutable-type?
Date: Thu, 19 Nov 2015 21:40:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Rob Browning <address@hidden> skribis:

> This crashes in 2.0:
>   (use-modules (srfi srfi-9 gnu))
>   (define-immutable-record-type foo
>     (foo x)
>     foo?
>     (x x))
>   (foo 1)
> like this:
>   foo.scm:10:9: In procedure #<procedure 131fd00 ()>:
>   foo.scm:10:9: In procedure make-struct: Wrong type argument in position 1: 
> #<procedure %foo-procedure (x)>
> Changing the type name to <foo> (or even xfoo) fixes the conflict, even
> though "define-immutable-type foo" actually creates a binding for <foo>,
> not foo.

This is expected.  The macro, like that of SRFI-9, creates one binding
for the record-type descriptor, one for the constructor, one for the
predicate, and one for the accessor.  Since the first two have the same
name, it Doesn’t Work.

The convention is indeed to use <foo> for the RTD.


reply via email to

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