Re: Lexical syntax for boxes
Alan Watson 21 May 2013 06:05 UTC
>> It would be useful to define eq?, eqv? and equal? on boxes. (F/X: Can
>> of worms being opened.)
>
> The definition of eqv? in RnRS covers them well enough: they are eqv? if
> the are the product of the same call to `box`, otherwise not. `Eq?` and
> `equal?` by their definitions must agree with `eqv?`.
If boxes are records, then eqv? behaves in this way, although eq? and equal? are not necessarily identical to eqv?. However, unless I am missing something, the SRFI does not require boxes to be records.
Defining equal? on boxes to be more like equal? on vectors of length 1 would be more useful, I think. That is, if boxes are records, then
(equal? (box 0) (box 0))
need not return #t. I would prefer that it was required to return #t.
Regards,
Alan