[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Slotted Arrays
- To: info-mcl-digest@cambridge.apple.com
- Subject: Slotted Arrays
- From: Shannon V Spires <svspire@somnet.sandia.gov>
- Date: Fri, 24 Jun 1994 09:57:53 -0600 (MDT)
- In-reply-to: <9406240800.AA22872@cambridge.apple.com> from "info-mcl-digest-request@cambridge.apple.com" at Jun 24, 94 04:00:04 am
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
> STANDARD-OBJECT.
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.
-Shannon
svspire@sandia.gov