[ENH] Symbol Spaces

Stephen Pair spair at advantive.com
Thu May 9 20:07:56 UTC 2002


If I had a nickel for every...

It just occurred to me that the hash function on LocalSymbol might not
work as fast as it could.  Adding the following hash method to
LocalSymbol will speed it up:

LocalSymbol>>hash

	^symbol hash


> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Stephen Pair
> Sent: Thursday, May 09, 2002 3:56 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: [ENH] Symbol Spaces
> 
> 
> 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 
> 
> 




More information about the Squeak-dev mailing list