[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: goops: initialize :after
From: |
Nicolas Neuss |
Subject: |
Re: goops: initialize :after |
Date: |
04 Oct 2000 16:29:06 +0200 |
David Pirotte <address@hidden> writes:
> Hello,
>
> I can not find similar methods in goops then we had in CLOS:
>
> defmethod initialize-instance :after ((blabla <...> ) &rest args)
> (skipped)
> can anyone knowing goops better then I has an idea ?
> thanks,
> david
>
You can do something quite similar by customizing the
initialize-method (I asked the same question some time ago and got
this hint from Marius Vollmer:-).
>From the GOOPS-Manual:
Note, however, that the power of GOOPS' metaobject protocol means
that everything written here may be customized or overridden for
particular classes! The slot initializations described here are
performed by the least specialized method of the generic function
`initialize', whose signature is
(define-method initialize ((object <object>) initargs) ...)
The initialization of instances of any given class can be
customized by defining a `initialize' method that is specialized
for that class, and the author of the specialized method may
decide to call `next-method' - which will result in a call to the
next less specialized `initialize' method - at any point within the
specialized code, or maybe not at all. In general, therefore, the
initialization mechanisms described here may be modified or
overridden by more specialized code, or may not be supported at
all for particular classes.
And an example:
(define-class <container> ()
(sizes #:accessor my-sizes #:init-keyword #:sizes)
(allocs #:accessor my-allocs))
(define-method initialize ((conti <container>) args)
(next-method) ; initialization from paras
(set! (my-allocs conti)
(make-list (length (my-sizes conti)) 0)))
Yours, Nicolas.