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

Keywords as DEFSTRUCT slots; also, EQUALP on DEFSTRUCT instances

    Date: Tue, 12 Jun 90 10:24 CDT
    From: lgm@iexist.att.com

    CLtL/2e implies that the package of a DEFSTRUCT slot name is irrelevant
    - only the symbol's print name is used.  (SLOT-VALUE could tell the
    difference if it is applicable to DEFSTRUCT instances, but I don't know
    if that's even been decided yet!)  When the package is irrelevant - the
    other similar situation that comes to mind is that of the LOOP macro's
    keywords - my personal preference is to use symbols in the keyword
    package, but the Symbolics compiler (Genera 7.2) seems to choke when I


    Shouldn't this work?

I think it's a bug that should be reported to Symbolics.  The problem is
that the expansion of DEFSTRUCT uses the slot names as parameter
variables in the constructor function, e.g.:


It would be better if it expanded into something like:

(DEFUN MAKE-STRUC (&KEY ((:A #:G0001)))

i.e. specify that the keyword :A be used to initialize a gensym.

    Also, can I portably expect EQUALP to compare DEFSTRUCT instances slot
    by slot, and to expect EQUAL not to do so?  CLtL/2e seems to say this,
    but then appears to contradict it elsewhere.

You're right, p.108 and p.109 of CLtL2 are contradictory.  The first
sentence of the new text on 108 should also have a forward reference to
the description of EQUALP of structures on the following page.  The lack
of a forward reference is a simple oversight on Guy's part; X3J13 was
quite clear that EQUALP of structures behaves as described on 109.

The concensus of X3J13 is that the description of EQUALP on structures
reflects the status quo.  CLtL1 implied that *all* objects with
components are compared recursively; X3J13 has limited this requirement
to particular types (in particular, we did this so that we wouldn't have
to define EQUALP of CLOS objects).  Therefore, it should be portable to
depend on this behavior of EQUALP.