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

Re: Lexical syntax for boxes



Alexey Radul scripsit:

> I don't think that's right.  The whole point of boxes is to be
> mutable; which means the correct treatment [1] thereof by equality
> predicates is to compare by identity.  

Henry Baker's `egal?`, though I like it very much, is not "the correct
treatment", in the sense of the only possible or reasonable treatment,
of equality.  There is a place for it, yes; but there is also a place
for contingent equality.  "Is the value in that box (of money, say) equal
to the value in this box?" is not an ill-posed question, and it is this
kind of equality that `equal?` provides in Scheme as it is.  By your
argument, since vectors are also usually used for their mutability,
`equal?` should reduce to `eqv?` on them too, yet this has never been so.

In short, `equal?` is and always will be flawed.  A generalized equality
predicate that can be tailored to specific applications is needed.
I think I'll push that ahead of hash tables, which I was planning to do next.

> [1] http://www.pipeline.com/~hbaker1/ObjectIdentity.html

-- 
An observable characteristic is not necessarily         John Cowan
a functional requirement.  --John Hudson                cowan@xxxxxxxx