String hierarchy (was: UTC-8 (was ...))

Bijan Parsia bparsia at email.unc.edu
Sat Mar 18 00:40:43 UTC 2000


On Fri, 17 Mar 2000, Maurice Rabb wrote:

> At 11:10 AM -0600 3/17/00, Lex Spoon wrote:
> >Maurice Rabb <m3rabb at stono.com> wrote:
> > > At 10:18 PM -0500 3/16/00, Bijan Parsia wrote:
> > > [snip a lot of interesting thoughts]
(Thanks for noticing ;))

> > > You know what?  My frustrations with the implementation straight
> > > jacket that String and Symbol currently have us in (due to being
> > > variableByteSubclasses) has me wanting to throw the baby out with the
> > > bathwater.

(And heck, after I made the point and you conceded it we only had two or
three people make it again. We want to be *sure* of you Maurice. We want
to know that you'll *never again* try to through *this* baby out with the
bathwater.

Heck! We'll make you *keep* the
bathwater! Distillation! Purification! You'll regret the day you
threatened our Precious Bodily Flui^H^H^H^HStrings!)

;)

> >in there.
> 
> The protocol is, or is almost exactly the same.  However, the total 
> behavior is different unlike other all other collection types (except 
> Interval) ArrayedCollections are not resizeable.

Just a point. It's not clear that Strings *should* be resizable. In
Python, they're an immutable type (like Tuples, unlike lists). In Prolog
and Erlang they are mutable---and indeed, they are just lists of
characters.

>  If you can modify 
> the elements of a string without copying it first, should it be 
> reasonable to be able to add characters to it , or remove characters 
> from it as well?  Thus the point of debate.

But this isn't an *accident* of implementation, imho, it's a design
decision (to have immutable strings). One could implement mutable strings
much as OrderedCollection works (i.e., with an internal array). Indeed,
you could have MutableString as a subclass of ORderedCollection without
harm.

However, the impetus for MutableStrings is somewhat reduced, imho, by
the streaming protocals. Indeed, one might want to move things like
#add: to Stream and make *all* the collections immutable. (WEll, at least
in size. I suppose you can still have mutation of elements. Big of me,
huh? ;))

There, I've done my best to draw your fire, Maurice! :)

> >I'm not so sure what is so wierd to people about a String being a
> >collection.  What else is a string but a sequenced collection of
> characters?
> 
> I have conceded that point.  Please don't beat me up. :-)

We won't beat you up, we'll KIDNAP your CHICKENS!!!!

What? No chickens. Dang. Such are the travails of mindless terrorism. ;)

Cheers,
Bijan "The once again sleep deprived" Parsia





More information about the Squeak-dev mailing list