From: Jonathon McKitrick
Subject: Practical uses for symbol-plist?
Date: 
Message-ID: <1146497090.546350.19280@y43g2000cwc.googlegroups.com>
That's one of the coolest things I learned in Peter's PCL.

Other than using it to track inherited slots, as Peter does, what are
some other practical uses for attaching a plist to a symbol?
From: Pascal Bourguignon
Subject: Re: Practical uses for symbol-plist?
Date: 
Message-ID: <873bft3f5j.fsf@thalassa.informatimago.com>
"Jonathon McKitrick" <···········@bigfoot.com> writes:
> That's one of the coolest things I learned in Peter's PCL.
>
> Other than using it to track inherited slots, as Peter does, what are
> some other practical uses for attaching a plist to a symbol?

Symbol plists were an essential features of the original lisp
implementations.  In LISP 1.5, the value, the name, the function
(subr, fexpr) attached to a symbol were attributes stored in the
symbol plist!  Actually, in LISP 1.5 symbols are nothing more than
their plist.

Nowadays, we like to see symbols like little structures:

(defstruct symbol
    name
    package
    value
    function
    plist)
 
but implementations are free to do it otherwise.

And since we have hash-tables, we like to put information into hash
table instead of storing it in the symbol plist.  It should be noted
however that in compiled implementations, going thru the hash table
(computing the hash) is slower than going thru 5 of 7 items in a
plist. Conversely, if you abuse symbol plist, with symbol plists
longer than 5 or 7 items it is more efficient to use separate hash
tables.
 

So, in practice, you can use symbol plist for anything you want,
everytime you want to associate some value to some key, but you should
consider other data structures too.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

This universe shipped by weight, not volume.  Some expansion may have
occurred during shipment.