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

equality of structures, or *default-structure-type*



If the :type option is not specified in defstruct, the structure is
represented in an implementation-dependent manner (CLtL p.314).
However, this implementation-dependentness introduces the ambiguity of
equality of structures.  Suppose that one implementation uses an array
for the default representation of a structure, while the other
implementation uses a list for it (of course, it's a silly
implementation).  The equality of structures may differ on these two
implementations, since equality of array is checked by the 'eq'ness
and that of list is checked by the equality of corresponding elements
(CLtL p.80).  For example,
	
	(defstruct foo a b c)

default :type = :array
	(equal (make-foo) (make-foo)) ===> nil
default :type = :list
	(equal (make-foo) (make-foo)) ===> t

This observation proves that we need introduce a new global variable,
say *default-structure-type*, in order to raise the portability of
COMMON Lisp programs.

Since I cannot find any messages on this matter in the archived
files at sumex, I post this message.

- Gitchang -
-------