Prev: ECL 10.4.1
Next: clbuild/darcs hangs on get?
From: Tim Bradshaw on 14 May 2010 14:45 On 2010-05-14 19:08:57 +0100, Tamas K Papp said: > (make-instance 'mv-t :mean (mean mv-normal) :sigma (variance mv- > normal) :nu nu) > > I can just use > > (let ((rv (allocate-instance (find-class 'mv-t)))) > (setf (slot-value rv 'mv-normal) mv-normal) > ...) Rather than doing this low-level hack, wouldn't it be much nicer to change the INITIALIZE-INSTANCE :AFTER method to take an extra argument which just does this. (defclass blob (...) ((goo :reader blob-goo) (defmethod initialize-instance :after ((b blob) &key ... (goo nil goop)) (if goop ;; if given the amount of GOO we do not need to compute it (setf (slot-value b 'goo) goo) (compute-goo b ...)))
From: Captain Obvious on 15 May 2010 08:28 TB> Rather than doing this low-level hack, wouldn't it be much nicer to TB> change the INITIALIZE-INSTANCE :AFTER method to take an extra argument TB> which just does this. Doesn't initialize-instance complain if you have keys which are not initargs? (I don't remember exactly, but I think I had problems with it.)
From: Tim Bradshaw on 15 May 2010 08:54
On 2010-05-15 13:28:27 +0100, Captain Obvious said: > Doesn't initialize-instance complain if you have keys which are not initargs? > (I don't remember exactly, but I think I had problems with it.) No. or rather, defining methods on INITIALIZE-INSTANCE is one part of defining what the valid initargs are. See section 7.1.2. |