[elephant-devel] set-valued slots review

Ian Eslick eslick at media.mit.edu
Tue Sep 27 19:25:39 UTC 2011


I was creating the set-valued slot API as a placeholder for something more native, but ran out of time to work on the project before really getting it done right.  As you say, the API is awkward.

I think it would be more convenient to use lists as the slot-level API and have a separate API for set operations.

(slot object) -> list | nil
(setf (slot object) list) -> list
(setf (slot object) nil) -> nil
(setf (slot object) atom) -> error or '(atom)

(insert-item 
(remove-item
(find-item 
(map-slot-set 

In general, feel free to use your judgement in upgrading the API - just check with the list that no one is deeply dependent on a particular feature.  Cached slots, pests, set-valued-slots are all beta features that I don't believe are being used seriously.  I'd be open to removing cached slots - they're just too restricting in how they can be used safely in a threaded and/or multi-server environment.

Thanks,
Ian

On Sep 12, 2011, at 8:31 AM, Alex Mizrahi wrote:

> > IV. Lacking features
>> 
>> I think it would be great if we also add features for:
>> 
>> 1. Initializing slot-set from list. Something like:
>> (setf (numbers-of obj1) (make-slot-set :items '(1 2 3 4))
>> 
>> 2. Wipe contents of a slot-set. You can do it via slot-makunbound, sure,
>> but it is kinda ugly. (setf (numbers-of obj) NIL) is kinda weird because
>> otherwise it doesn't recognize lists.
>> (setf (numbers-of obj1) (make-slot-set) is, perhaps, appropriate, except
>> it would create unnecessary object.
>> 
>> 
> 
> Or, alternatively, use lists:
> 
> (setf (numbers-of obj) '(1 2 3))
> (setf (numbers-of obj) ())
> 
> It is kinda asymmetric because accessor will return a slot-set object rather than a list, but at least it is more consistent than using setf for inserting items.
> 
> 
> _______________________________________________
> 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