[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assigning default slot value plus side effects?
- To: CommonLoops.PA@Xerox.COM
- Subject: Re: Assigning default slot value plus side effects?
- From: hall@aplcen.apl.jhu.edu (Marty Hall)
- Date: Fri, 13 Jul 90 09:41:10 EDT
- In-reply-to: "Peter N. Saurugger"'s message of Jul 11, 18:04
- Redistributed: CommonLoops.PA
I had an application where, there were side effects that needed to occur
for all values in a certain slot of a class of objects. I noted that
it was obvious how to do this for changed values, by attaching a :after
method to (setf <accessor>) on the slot, but that I couldn't find a way
to make use of default values this way, because initialize-instance
uses slot-value (not the accessors) for putting values in slots.
Of course, I could write my own initialization function that initializes
the object then puts in the values using the accessors, but (being new
to clos), I wondered if I had overlooked something clean way of doing it.
Peter Saurugger responded that he didn't think there was any clean
approach, and went on to say:
>
> While the X3JI3 Specs mention the possibility of adding to the existing
> initialization-protocol, the behaviour you describe does not seem to be
> mentioned in this document.
>
> I agree very strongly with you that on initialization I would expect the
> same behaviour as when updating a slot. I do not know whether these specs
> still can be amended, but if there is no major reason against this, why
> not "vote" on the possibility of an amendment to the behaviour of
> shared-initialize ?
How does one "vote"? Also, does anyone know the motivation of X3J13 for
using slot-value instead of the accessors for initialization? Is there
a big efficiency win there?
- Marty Hall
------------------------------------------------------
hall@aplcen.apl.jhu.edu, hall%aplcen@jhunix.bitnet, ..uunet!aplcen!hall
Artificial Intelligence Lab, AAI Corp, PO Box 126, Hunt Valley, MD 21030