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

Re: Lexical syntax for boxes

This page is part of the web mail archives of SRFI 111 from before July 7th, 2015. The new archives for SRFI 111 contain all messages, not just those from before July 7th, 2015.



Alan Watson scripsit:

> 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.

It does not, but the content of a box is obviously a location, and it
would be contrary to the spirit, if not the letter, of RnRS to make things
`eqv?` that denote distinct locations, or not `eqv?` if they denote the
same location.  As for `eq?`, it must behave the same as `eqv?` except
for the specific and traditional exceptions of characters and bignums.

> Defining `equal?` on boxes to be more like `equal?` on vectors of
> length 1 would be more useful, I think.

It might or it might not be, depending on one's needs.  You might want
`equal?` to look right through boxes, or you might want to insist that
boxes are `equal?` only if they are `eqv?`.  That's why a generalized
equality predicate that can, but need not, descend into various things
is so useful: you can tailor it to your needs and easily create your own
best equality predicate(s) for each new circumstance.  That allows the
exact details of what `equal?` does to be of mostly historical interest:
it does the right thing in simple cases, and is implementation-dependent
elsewhere.

-- 
John Cowan                              cowan@xxxxxxxx
            http://www.ccil.org/~cowan
Humpty Dump Dublin squeaks through his norse
                Humpty Dump Dublin hath a horrible vorse
But for all his kinks English / And his irismanx brogues
                Humpty Dump Dublin's grandada of all rogues.  --Cousin James