chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] SRFI-57 does not seem to respect type


From: felix winkelmann
Subject: Re: [Chicken-users] SRFI-57 does not seem to respect type
Date: Fri, 15 Apr 2005 07:33:02 +0200

On 4/15/05, Zbigniew Szadkowski <address@hidden> wrote:
> Hello,
> 
> Either I am not understanding SRFI-57, or I have found a bug.
> 
> Consider the following:
> 
> (use srfi-57)
> ; loading /usr/local/lib/chicken/srfi-57.scm ...
> ; loading library srfi-1 ...
> ; loading /usr/local/lib/chicken/srfi-57-support.so ...
> (import records)
> (define-record-type foo (make-foo x) foo? (x get-foo-x))
> (define-record-type bar (make-bar x) bar? (x get-bar-x))
> (define-record-type baz (make-baz x y) baz? (x get-baz-x) (y get-baz-y))
> (get-foo-x (make-bar 3))
> ==> 3
> (get-bar-x (make-foo-3))
> ==> 3
> (equal? (make-foo 3) (make-bar 3))
> ==> #t
> (get-baz-y (make-bar 3))
> ==> Error: out of range
> 
> As far as I am concerned, none of these should succeed because the
> types are incompatible.  When performed with straight SRFI-9, you get
> "Error: bad argument type - not a structure of the required type", and
> #f for the equal?.
> 
> [Also, in SRFI-57 the types show up as #<record> instead of #<foo> or
> #<bar>, but I am assuming this is a known limitation.]
> 

You are right, even though the predicates work, there isn't
much error checking. Unfortunately I don't understand the
srfi-57 code well enough to do much about it.
But I'll look into the second issue...


cheers,
felix




reply via email to

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