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

Re: Bugs found in MCL 2.0b1p2



    ...  In addition, I think I've found a bug which exhibits itself
    in the following manner:
    
    Initial conditions:
     - There is a constant definition of the following form:
    	(defconstant *xxx* '(nil))
     - This constant is inserted into list structures, and used as a tag
    to indicate that the data following it has certain characteristics.
    
    Later:
     (after some processing) while traversing one of the list structures
    into which this value was inserted, the "(nil)" part of the list
    structure fails to be EQ to the (defined) constant (identifier).
   
I believe you're assuming a closer connection between defconstant and
eq than the language actually defines.  (defconstant *xxx* '(nil))
indicates that the BINDING of the value '(nil) to the variable *xxx*
will not change, e.g., the value is a cons.  Inserting a constant into
a list doesn't imply that you can match it later with eq.

(defconstant *xxx* '*xxx*) will "work" because interned symbols are
guaranteed to be EQ, at least until there's some other reference to
that symbol.

For "anonymous" marking-values that can't collide with any other values,
I recommend
    (defvar *xxx* (gensym))
or
    (defvar *xxx* (cons nil nil))

Note: defvar and not defconstant.  What's important is that there's
a unique VALUE being used.  The constancy of the BINDING is irrelevant.

Footnote:  You say that eq failed "after some processing".  I'd be
very surprised to hear that it succeeded at one time and failed later
on.  If that actually happened, it does indeed sound like a bug.