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

Are isomorphic structures EQUAL?



    Date: Wed, 28 May 86 18:37 EDT
    From: David A. Moon <Moon@SCRC-STONY-BROOK.ARPA>

	Date: 11 Apr 1986 16:43-EST
	From: NGALL@G.BBN.COM

	What happens to implementations that want to represent structures
	using plain old vectors?  How will EQUAL distinguish vectors from
	structure-vectors?

    As Rees pointed out, such an implementation would not be legal.

I checked CLtL again and found (as far as I could tell) that it IS
permissible for an implementation to represent structures as vectors, or
as numbers, packages, symbols, or any other kind of object.

I would like to change the language so that the the type of structures
(whose DEFSTRUCT doesn't use :TYPE) is disjoint from other types.  I
think this is desirable both because it's a generally useful feature
(one can create new opaque types, and rely on disjointness) and because
it makes it easier to avoid implementation dependencies.  It is very
easy now to unwittingly assume in a program that one's structures aren't
e.g. symbols or vectors or functions, and have the program work in 9 out
of 10 Common Lisp implementations, and then fail in a very obscure way
when moved to a new implementation.

I don't much care whether EQUAL descends into structures, as long as
it's consistent within and between implementations.  I would mildly
object to having it recursively compare components because that seems to
be a violation of the data abstraction capability that structures are
supposed to provide.  People who use :TYPE have to be aware that they
can have problems if they change an implementation from a transparent
one to an opaque one; not only EQUAL, but also CONCATENATE and TYPEP
will change their behavior.

Jonathan