From: Christian Betz
Subject: Re: CLOS problem: `initialize-instance' etc
Date: 
Message-ID: <betz-2104991406120001@wi6a85.informatik.uni-wuerzburg.de>
In article <··············@eho.eaglets.com>, ···@goems.com wrote:

> (defclass z () (x))
> (defmethod initialize-instance :after ((a z) &rest junk) ... do something)
> (defun aaa-to-z (a)
>   (let ((zz (make-instance 'z)))
>     (when ......
>       (setf (slot-value z 'x) ....))))
> 
> Unfortunately this means that when `initialize-instance :after' is
> invoked, the slot 'x is still unbound.  Aparently, I can do
> 
> (defmethod initialize-instance :around ((a z) &rest args &key x)
>   (unless x (remf args 'x))
>   (call-next-method)
>   ... do something)
> 
> (defun aaa-to-z (x)
>   (let ((zz (make-instance 'z 'x (when .... .....))))
>    ....))
> 
> the problem is that this uses up NIL as a valid value for the slot X.
> 
> What is the right way to deal with the problem?

There's key-supplied-p as posted by Barry Margolin, but there's also
shared-initialize, which initializes a given slot. You just might use that
for your slot x.

Have fun with it.

Chris