[elephant-devel] Re: Derived Indicies

Ian Eslick eslick at media.mit.edu
Sat Mar 22 16:44:14 UTC 2008


Do you think you might want to compute derived index updates based on  
the value in a transient slot?

The implementation I've chosen is a little different than described  
last night:

(defpclass foo ()
  ((slot1 :accessor slot1 ...)
   (slot2 :accessor slot2 ...)
   (slot3 :accessor slot3 ...)
   (derived :reader foo-value :derived-fn my-fn :slot-deps (slot1  
slot3))))

:index t is not necessary - in fact it is ignored.  :slot-deps are  
also not required, but the derived index is updated on any slot write  
if that slot is not transient, set-valued or an association.  We can  
add those last three slot types into the mix if necessary, but I'm  
trying to avoid too much complex computation taking place during slot  
writes (self-deadlock, etc) for the time being.

Also, I'm allocating persistent storage for each derived value - this  
is so it is easy to remove the prior value when the value has  
changed.  We can optimize this away later, but it adds enough to  
complexity I wanted to get derived slots working first.

Cheers,
Ian

On Mar 21, 2008, at 6:40 PM, Alex Mizrahi wrote:
> IE> Does anyone actually use derived indices in the current slot  
> indexing
> IE> model?
>
> add-class-derived-index?
> yep, we are using them, as they are only way to make some non-trivial
> lookups
>
>
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel




More information about the elephant-devel mailing list