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

Issue: EQUAL-STRUCTURE (Version 4)



JonL was right.. I tried to fix it. Ready for release?


!
Issue:        EQUAL-STRUCTURE
References:   EQUAL (p80), EQUALP (p81)
Category:     CLARIFICATION/CHANGE
Edit history: 18-Mar-88, Version 1 by Pitman
	 8-Jun-88, Version 2 by Masinter (add Benson's proposal)
	23-Sep-88, Version 3 by Masinter (remove all but STATUS-QUO)
	 1-Oct-88, Version 4 by Masinter (fix description)


Problem Description:

  The behavior of EQUAL and EQUALP on structures is a subject of controversy.
  At issue are whether these functions should descend the slots of structures
  or use simply the structure's primitive identity (i.e., EQ) to test for
  equivalence.

Proposal (EQUAL-STRUCTURE:STATUS-QUO):

  Clarify that EQUAL and EQUALP do not descend any structures or
  data types other than the ones explicitly specified in CLtL. 
  EQUAL uses EQL for numbers and characters, descends structure for CONSes 
  bit-vectors, strings; has special behavior for pathnames as specified
  in CLtL,  and uses EQ for all other types. 

  EQUALP is similar, except that it ignores case in strings, descends
  the structure of arrays, defstruct and CLOS instances. It uses EQ
  for all other types; for example, it does not descend hash tables.


Rationale:

  There seem to be as many different equality primitives as there
  are applications for them. None of the possible ways of changing
  EQUAL or EQUALP are flawless. Given the inability to "fix" them,
  it is better to leave them alone.

Current Practice:

  We are unaware of any extensions to CLtL's set of operations,
  although frequently users request them.

Cost to Implementors:

  Since this seems to be compatible with the status quo, none.

Cost to Users:

  same

Cost of Non-Adoption:

  Ongoing controversy about whether EQUAL and EQUALP "do the right thing".

Benefits:

  A feeling that EQUAL and EQUALP exist and/or do what they do because serious
  consideration was given and we consciously decided on a particular resolution
  to the numerous questions that have come up about them.

Aesthetics:

  There seems to be wide debate about what the proper aesthetics for
  how equality should work in Common Lisp. While the status quo is not
  aesthetically more pleasing than the various alternatives.  Aesthetic
  considerations vary widely. Different people model structures
  differently. Sometimes the same person models structures differently in
  different situations. The question of which should be descended and which
  should not is a very personal one, and the aesthetic attractiveness of any
  of these options will vary from person to person or application to
  application.

Discussion:

  An earlier version of this issue with various alternatives was distributed
  at the June 1988 X3J13 meeting. Since
  this is a frequently raised issue, we thought we should submit it
  as a clarification although there is no change to CLtL.

  We considered:
     removing EQUAL and EQUALP from the standard.
     changing EQUALP to descend structures.
     changing EQUALP to be case sensitive.
     adding a :TEST keyword to EQUAL.
     making EQUAL a generic function

  All of these had some serious problems.