String refactoring
Andreas Raab
andreas.raab at gmx.de
Mon Apr 11 08:48:59 UTC 2005
Hi Folks,
Since I was working on it anyway I decided to give it a go and refactor
the whole String hierarchy. For those of you who haven't looked at it,
this is how it looks today:
AbstractString (221 methods)
String (46 methods)
Symbol (46 methods)
MultiString (79 methods)
MultiSymbol (48 methods)
--------------------------------------
440 methods
And this is how it looks after installing the attached changes:
String (236 methods)
ByteString (21 methods)
MultiString (33 methods)
Symbol (47 methods)
ByteSymbol (13 methods)
MultiSymbol (14 methods)
--------------------------------------
364 methods
The changes also fix many other issues, starting from having multiple
symbol tables (in Symbol and MultiSymbol) up to problems with hash
computations (String and MultiString did not compute the same hash which
is very bothersome). MultiCharacter is gone, too.
There are no incompatible changes in the interface *except* from the
removal of MultiCharacter and *except* from a number of idiosynchratic
methods in MultiString (such as findMultiString... etc). There have been
no incompatible changes to the Character, String, and Symbol interface,
therefore I expect everything to work smoothly, *except* if you use
patterns such as "foo class == String" or "foo isMemberOf: Symbol" (both
String and Symbol are abstract classes like Number and Integer). In
these cases you need to use #isString or #isSymbol. Note however that
(equally ugly :-) uses such as "foo isKindOf: String" or "foo isKindOf:
Symbol" will now actually work correctly (e.g., cover both the Byte and
Multi variants).
I have also successfully loaded a number of projects, morph files and
(perhaps most importantly ;-) was able to open a SqueakMap browser
(which implies that it updated itself from the net). So right now I'm
feeling pretty good about this stuff, so give it a try. All of this has
been tested on the latest 3.8 image.
Note that if someone has really strong feelings about names, now might
be a good time to voice them - my feeling is that likely we will only
want to go through all of these hazzles once so if you're unhappy with
the names speak now.
Cheers,
- Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StringRefactor.sar
Type: application/octet-stream
Size: 64030 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20050411/1d8ecaad/StringRefactor.obj
More information about the Squeak-dev
mailing list
|