Back: Behavior-testing the method dictionary Up: Base classes Forward: BindingDictionary-accessing   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.9 BindingDictionary

Defined in namespace Smalltalk
Superclass: Dictionary
Category: Language-Implementation
I am a special form of dictionary that provides special ways to access my keys, which typically begin with an uppercase letter; also, my associations are actually VariableBinding instances.

My keys are (expected to be) symbols, so I use == to match searched keys to those in the dictionary -- this is done expecting that it brings a bit more speed.

1.9.1 BindingDictionary: accessing  (instance)
1.9.2 BindingDictionary: basic & copying  (instance)
1.9.3 BindingDictionary: copying  (instance)
1.9.4 BindingDictionary: forward declarations  (instance)
1.9.5 BindingDictionary: printing  (instance)
1.9.6 BindingDictionary: testing  (instance)


1.9.1 BindingDictionary: accessing

define: aSymbol
Define aSymbol as equal to nil inside the receiver. Fail if such a variable already exists (use #at:put: if you don't want to fail)

doesNotUnderstand: aMessage
Try to map unary selectors to read accesses to the Namespace, and one-argument keyword selectors to write accesses. Note that: a) this works only if the selector has an uppercase first letter; and b) `aNamespace Variable: value' is the same as `aNamespace set: #Variable to: value', not the same as `aNamespace at: #Variable put: value' -- the latter always refers to the current namespace, while the former won't define a new variable, instead searching in superspaces (and raising an error if the variable cannot be found).

environment
Answer the environment to which the receiver is connected. This can be the class for a dictionary that holds class variables, or the super-namespace. In general it is used to compute the receiver's name.

environment: anObject
Set the environment to which the receiver is connected. This can be the class for a dictionary that holds class variables, or the super-namespace. In general it is used to compute the receiver's name.

import: aSymbol from: aNamespace
Add to the receiver the symbol aSymbol, associated to the same value as in aNamespace. Fail if aNamespace does not contain the given key.

name
Answer the receiver's name, which by default is the same as the name of the receiver's environment.

nameIn: aNamespace
Answer the receiver's name when referred to from aNamespace; by default the computation is deferred to the receiver's environment.


1.9.2 BindingDictionary: basic & copying

= arg
Answer whether the receiver is equal to arg. The equality test is by default the same as that for equal objects. = must not fail; answer false if the receiver cannot be compared to arg

hash
Answer an hash value for the receiver. This is the same as the object's #identityHash.


1.9.3 BindingDictionary: copying

copy
Answer the receiver.

copyEmpty: newSize
Answer an empty copy of the receiver whose size is newSize

copyEmptyForCollect
Answer an empty copy of the receiver which is filled in to compute the result of #collect:

copyEmptyForCollect: size
Answer an empty copy of the receiver which is filled in to compute the result of #collect:

deepCopy
Answer the receiver.

shallowCopy
Answer the receiver.


1.9.4 BindingDictionary: forward declarations

at: key put: value
Store value as associated to the given key. If any, recycle Associations temporarily stored by the compiler inside the `Undeclared' dictionary.


1.9.5 BindingDictionary: printing

printOn: aStream in: aNamespace
Print the receiver's name when referred to from aNamespace; by default the computation is deferred to the receiver's environment.


1.9.6 BindingDictionary: testing

species
Answer `IdentityDictionary'.



Back: BindingDictionary-printing Up: BindingDictionary Forward: BlockClosure   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on February, 22 2012 using texi2html