[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Slotted Arrays

David Bright asks-
> Anyone know how to make a new object that amounts to an array with a few
> extra slots?  I'd like to have some lists, pathnames, etc. tag along with
> some arrays, and yet have the arrays respond normally to AREF.  I'm having
> trouble doing the usual thing because arrays do not inherit (?) from

Why not create a Clos class that contains an array as one of its
slots, and create a generic function called s-aref (or whatever)
that just calls aref for normal arrays, but which pulls the array from
a slot when called on a "slotted array" instance. This requires
you to use this new function instead of aref, but other than that
it's pretty clean.