String hierarchy (was: UTC-8 (was ...))
Richard A. O'Keefe
ok at atlas.otago.ac.nz
Thu Mar 23 04:22:54 UTC 2000
Common Lisp, I understand, *defines* a string as an array of characters
(where arrays are mutable in both ways, I believe).
Indeed. After
(setq x (make-array 4 :element-type 'character
:initial-element #\space
:adjustable t))
you'll find that
(stringp x)
is true. You'll also be able to do
(adjust-array x 6 :initial-element #\*)
after which x prints as
" **"
without losing its identity.
(Ok, so [CLtL2 p 33]: "the type string [is] the union of one or more
specialized vector types, the types of whose elements are subtypes of
the type character" and "vectors" don't have the :adjustable option set.)
Subtypes of string include
simple-string, ...
So:
String
ImmutableString
Symbol
Sounds good to me.
Sounds inside-out to me. A String can do anything that an ImmutableString
can, not the other way around.
ReadableString
|
+--Symbol
|
+--String
looks rather better. Symbols have guarnateed uniqueness, which _adds_
something to ReadableString; Strings have mutability, which _adds_
something to ReadableString.
More information about the Squeak-dev
mailing list
|