[ENH] Symbol Spaces

Stephen Pair spair at advantive.com
Thu May 9 19:56:18 UTC 2002


The attached change sets should be filed-in in the following order:

  symspaces-preload.cs
  symspaces.cs

Note, due to very careful ordering of doIts in the preload, this change
set will not file-out properly once filed-in.  These change sets were
implemented (and tested) on a fully updated 3.3a image.

These change sets implement symbol spaces.  The following changes are
made in the String hierarchy (AbstractString, AbstractSymbol,
LocalSymbol are new classes):

...
  ArrayedCollection
    AbstractString
      AbstractSymbol
        LocalSymbol
        Symbol
      String

Additionally, the following two classes are added:

...
  SymbolSpace
    GlobalSymbolSpace

These changes have the (not to be overlooked) side benefit of making it
easier to create classes that are polymorphically compatible with String
and Symbol.  Addtionally, Symbol now uses an instance of
GlobalSymbolSpace to manage the global symbols.

To create a new symbol space and add a symbol to it, do the following:

  SymbolSpace new intern: 'someNewLocalSymbol'

The idea behind these change sets is that they might eventually get used
to do such things as:

  - implement a local symbol table for each module (just add an instvar
called "symbols" to the Module class and have it hold onto a
SymbolSpace)
  - implement "Selector Name Spaces" by using LocalSymbols as keys in
method dictionaries
  - implement "Instance Variable Name Spaces" with a similar technique
(i.e. have a dictionary of "instvars" attached to an instance with
LocalSymbols for keys)

SymbolSpace includes an "owner" instance variable to make the lookup
from a LocalSelector to the owner of the SelectorSpace quick if needed.
Also, the refactoring might make other things (like Unicode support) a
tad easier.

- Stephen 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: symspaces.cs
Type: application/octet-stream
Size: 5065 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020509/4e0c8267/symspaces.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: symspaces-preload.cs
Type: application/octet-stream
Size: 13035 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020509/4e0c8267/symspaces-preload.obj


More information about the Squeak-dev mailing list