>
>  You can do that without persistent class slots -- make a counter class and
> update its value.
> Something like this:
>
> (defpclass counter ()
>  ((classname :index t :initarg :classname)
>   (counter :initform 0)))
>
> Then you can increment it automatically:
>
> (defmethod initialize-instance ((foo bar) &key &allow-other-keys)
>  (let ((counter (get-instance-from-value 'counter 'classname 'bar)))
>    (incf (slot-value counter 'counter))))
>
> It isn't pretty but it will work.
> Moreover, you need to implement this only once, so it doesn't matter how it
> is implemented.
>
> If we implement class slots, they will work in a similar way under the
> hood.
>
>
>

Thanks. This is a neat trick.

BTW: for now I have dropped the use of Elephant for some reasons (my own
compilation issues with BDB, BDB licence, performance, query power). But
thank you and other Elephant developers very much for your help in my
investigation of this framework.
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to