[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: email@example.com
- Subject: EQUAL
- From: jrose@Sun.COM (John Rose)
- Date: Mon, 13 Jun 88 10:04:00 PDT
- Cc: firstname.lastname@example.org
- In-reply-to: Jim McDonald's message of Fri, 10 Jun 88 18:27:18 PDT <8806110127.AA03445@bhopal.lucid.com>
Date: Fri, 10 Jun 88 18:27:18 PDT
From: Jim McDonald <email@example.com>
Thus EQUAL is (in some historical sense) defined to make it easy to do
pattern matching on code. Since code traditionally becomes read-only,
this is more-or-less consistent with collapsing EQUAL structures to be
EQ. I claim that the traditional explanation for EQUAL's semantics
(that EQUAL means roughly HAVE-THE-SAME-PRINT-REPRESENTATION-P) is
actually just an observation based on this more fundamental reason.
Also, since people in general have some esthetic sensibilities, a
fully haired roll-your-own equality predicate seems unlikely.
Date: Sat, 11 Jun 88 17:32:08 PDT
From: Jon L White <firstname.lastname@example.org>
I like you analysis, and think it explains very well why EQUAL has the
peculiar semantics that it now has.
How would you feel about extending EQUAL to descend defsturct structures
and T-type arrays? it wouldn't mess up its utility for its original
purpose, and would satisfy an enormous number of Lisp users. Of course,
EQUAL type hashtables would work with this new definition.
-- JonL --
To add fuel to the fire: Since EQUAL bears an observable relationship
to READ and WRITE, there's an obvious way to supply a "fully haired
roll-your-own equality predicate". Add, to EQUAL, keyword arguments
analogous to WRITE, for controlling these debatable behaviors.
E.g., the people who want to compare array substructure would
use a call like this:
(EQUAL X Y :ARRAY T)
Comparison of structures would be controlled by the :STRUCTURE
keyword. Hash tables could be handled similarly, especially
if hash-table printing is ever made standard. Perhaps case
sensitivity in strings could be controlled by :CASE.
Something should be done for numbers too.
I hope there's no call for the analogous special variables,
We might go further, by allowing the argument to :ARRAY or
:STRUCTURE to be an equality predicate instead of a boolean.
This would allow somewhat better control over, e.g., which
types of structure were to be opened up for comparison.
(A DEFSTRUCT option controlling equality behavior would be
much preferable, for reasons of modularity.)
- From: Jim McDonald <email@example.com>