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

Re: Question about collections



On Thu, 24 Feb 2000, Chris Double wrote:
> I don't know if this helps but...
> 
> neelk@brick.cswv.com (Neel Krishnaswami) writes:
> >
> > Does stretchines mean that size can change without losing object
> > identity, or is it something else? I'm guessing the latter from the
> > fact that <list> isn't a <stretchy-collection>, but I'm honestly not
> > sure.
> 
> Chapter 8 (Collections) of the DRM describes <mutable-collection> and
> <stretchy-collection> as:
> 
>   "Instances of <mutable-collection> can have their elements changed
>   after they are created. Instances of <stretchy- collection> can have
>   keys added and removed after they are created."

In particular, these things have to be able to happen while preserving
object identity.  This is why <list> isn't a stretchy-collection: you
can't add an element to the head of a list (a binding to the old head of
the list will now point to the second element) nor remove all elements
from a (non-empty) list (a binding to the old head will still refer to
it, even though it's not in your new list, possibly preventing it being
GC'd) while preserving identity.  Maybe a better way to describe this
would be "binding identity"?

To answer Bruce's question with MHO, I look at these mixins as interface
specifications rather than implementation characteristics.

HTH,
Hugh




Follow-Ups: References: