Hi Rob,
Rob Browning <[email protected]> writes:
> 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)>
The problem is that (define-immutable-record-type foo ...) binds 'foo'
to the record-type-descriptor (rtd), and you are also binding 'foo' to
the constructor. I suppose we should try to improve the error message
in cases like this.
> Changing the type name to <foo> (or even xfoo) fixes the conflict,
Right.
> even though "define-immutable-type foo" actually creates a binding for
> <foo>, not foo.
I believe you are mistaken about that. Looking at both the code and the
expansion of your 'define-immutable-record-type' form above, I see no
evidence that <foo> is bound to anything by it.
Regards,
Mark