Category: Language-Implementation
Superclass: String
My instances are unique throughout the Smalltalk system. My instances behave for the most part like strings, except that they print differently, and I guarantee that any two instances that have the same printed representation are in fact the same instance.

Method category index

built ins (class)
instance creation (class)
symbol table (class)
accessing the method dictionary (instance)
basic (instance)
built ins (instance)
converting (instance)
misc (instance)
storing (instance)
testing (instance)
testing functionality (instance)

built ins (class)

intern: aString
Private - Same as 'aString asSymbol'

top


instance creation (class)

internCharacter: aCharacter
Answer the one-character symbol associated to the given character.

new

This method should not be called for instances of this class.

new: size

This method should not be called for instances of this class.

with: element1

Answer a collection whose only element is element1

with: element1 with: element2

Answer a collection whose only elements are the parameters in the order they were passed

with: element1 with: element2 with: element3

Answer a collection whose only elements are the parameters in the order they were passed

with: element1 with: element2 with: element3 with: element4

Answer a collection whose only elements are the parameters in the order they were passed

with: element1 with: element2 with: element3 with: element4 with: element5

Answer a collection whose only elements are the parameters in the order they were passed

top


symbol table (class)

hasInterned: aString ifTrue: aBlock
If aString has not been interned yet, answer false. Else, pass the interned version to aBlock and answer true. Note that this works because String>>#hash calculates the same hash value used by the VM when interning strings into the SymbolTable. Changing one of the hashing methods without changing the other will break this method.

isSymbolString: aString

Answer whether aString has already been interned. Note that this works because String>>#hash calculates the same hash value used by the VM when interning strings into the SymbolTable. Changing one of the hashing methods without changing the other will break this method.

rebuildTable

Rebuild the SymbolTable, thereby garbage-collecting unreferenced Symbols. While this process is done, preemption is disabled because it is not acceptable to leave the SymbolTable in a partially updated state. Note that this works because String>>#hash calculates the same hash value used by the VM when interning strings into the SymbolTable. Changing one of the hashing methods without changing the other will break this method.

top


accessing the method dictionary (instance)

implementors
Answer a Set of all the compiled method associated with selector named by the receiver, which is supposed to be a valid message name.

top


basic (instance)

deepCopy
Returns a deep copy of the receiver. As Symbols are identity objects, we actually return the receiver itself.

keywords

Answer an array of keywords that compose the receiver, which is supposed to be a valid message name (#+, #not, #printOn:, #ifTrue:ifFalse:, etc.)

numArgs

Answer the number of arguments supported by the receiver, which is supposed to be a valid message name (#+, #not, #printOn:, #ifTrue:ifFalse:, etc.)

shallowCopy

Returns a deep copy of the receiver. As Symbols are identity objects, we actually return the receiver itself.

top


built ins (instance)

= aSymbol
Answer whether the receiver and aSymbol are the same object

hash

Answer an hash value for the receiver. Symbols are optimized for speed

top


converting (instance)

asString
Answer a String with the same characters as the receiver

asSymbol

But we are already a Symbol, and furthermore, Symbols are identity objects! So answer the receiver.

top


misc (instance)

species
Answer `String'.

top


storing (instance)

displayOn: aStream
Print a represention of the receiver on aStream. For most objects this is simply its #printOn: representation, but for strings and characters, superfluous dollars or extra pairs of quotes are stripped.

displayString

Answer a String representing the receiver. For most objects this is simply its #printString, but for strings and characters, superfluous dollars or extra pair of quotes are stripped.

printOn: aStream

Print a represention of the receiver on aStream.

storeLiteralOn: aStream

Print Smalltalk code on aStream that compiles to the same symbol as the receiver.

storeOn: aStream

Print Smalltalk code on aStream that compiles to the same symbol as the receiver.

top


testing (instance)

isSimpleSymbol
Answer whether the receiver must be represented in quoted-string (e.g. #'abc-def') form.

top


testing functionality (instance)

isString
Answer `false'.

isSymbol

Answer `true'.

top