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

Re: [Scheme-reports] eq? and eqv? for records



Sascha Ziemann <ceving@x> writes:

> So R7RS does not guaranty that the following will always return #f:
>
> (define-record-type :identifier (identifier) identifier?)
> (eq? (identifier) (identifier))

No, it doesn't guarantee that.

(Currently it doesn't guarantee *anything* because the location-in-store
semantics for records have apparently been overseen, but that's just me
being pedantic; I think the *intent* was that the example you've given
is explicitly left unspecified as a special-case even though the rest of
the semantics is mostly obvious/intuitive.)

> In order to be sure I have to add a dontcare slot with a dontcare
> value?

You don't need to give it a value, the constructor doesn't need to take
values for all fields.  For example:

(define-record-type <token>
  (token) token?
  (dummy-slot token-dummy-slot set-token-dummy-slot!))

(eq? (token) (token))  =>  #false

Taylan

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports