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

Re: :accessor-prefix bug

    From: kempf%hplabsz@hplabs.HP.COM
    > I think that that makes with-slots into a truly dangerous form.
    > Code that uses with-slots without the :prefix can be broken by adding a
    > slot to the class definition.
    That's true whether or not the :prefix option is there, and whether or
    not you use WITH-SLOTS or the accessor function directly. If you delete
    a slot (for example) the accessor function is undefined, so any method
    using the accessor function will break. Similarly, if you delete a
    slot even using the :PREFIX option, the code within the WITH-SLOTS 
    would need to be changed, otherwise it will break when you try to 
    reference the slot next time (precisely, a call to SLOT-MISSING will

The case of deleting a slot doesn't worry me as much since code that
referenced a slot which no longer exists must be fixed for semantic
reasons.  In the case of adding slot, with slots causes a new binding
for some symbol.  Something like:

  (defclass foo () (a))

  (defmethod bar ((foo foo))
    (let ((b :value-i-expect))
      (with-slots (foo)
        . . .)))

  . . .

  (defclass foo () (a (b :value-that-breaks-my-code)))

shows how code might be broken in a way that (a) might not be related
to the new semantics related to the slot addition and (b) could easily
have been prevented locally in the bar method with:

(defmethod bar ((foo foo))
  (let ((b :value-i-expect))				
    (with-slots ((foo :prefix foo-))

Is there another mailing list where changes to the specification are
being discussed before the decisions are made?  Would someone please
add me?