Let us be more productive :)
A BrowserEnvironment
has an environment input= a systemDictionary (may be we should call it
origin)
a selectedEnviroment = a composite based on the BrowserEnvironment
hierarchy
The precondition is that it does not make sense to mix apple and orange so
selectedEnvironment inside a composite to be meaningfull should sahre the same
origin.
Now it does not mean that we cannot have different composite over the same
origin (ie we have
multiple queries over Smalltalk globals) or that we cannot have different and
separate composite
working on different origin (ie I have a selection on Pharo1.2 and one on
Pharo1.3 or a remote one).
On Mar 18, 2011, at 10:09 PM, Lukas Renggli wrote:
> - BrowserEnvironment>>#copyEmpty
copyEmpty
^ self class new on: SystemDictionary new; yourself.
> - BrowserEnvironment>>#&
& anEnvironment
"If we or anEnvironment includes everything, then just include the
other environment (optimization)"
self isSystem ifTrue: [^anEnvironment].
anEnvironment isSystem ifTrue: [^self].
^AndEnvironment onEnvironment: self and: anEnvironment
does not change
> - BrowserEnvironment>>#I
| anEnvironment
"If we or anEnvironment includes everything, then return it instead of
creating
an or that will include everything."
self isSystem ifTrue: [^self].
anEnvironment isSystem ifTrue: [^anEnvironment].
^ OrEnvironment onEnvironment: self or: anEnvironment
> - BrowserEnvironment>>#not
not
self isSystem ifTrue: [^SelectorEnvironment new].
^NotEnvironment onEnvironment: self
> - BrowserEnvironment>>#isSystem
isSystem
^true
No problem (this could be renamed isOriginalInput but we keep it for
compatibiity
> - ClassEnvironment>>#classesDo:
classesDo: aBlock
classes do: [ :each |
| class |
class := Smalltalk globals at: each ifAbsent: [ nil ].
(class notNil and: [ environment includesClass: class ])
ifTrue: [ aBlock value: class ] ].
metaClasses do: [ :each |
| class |
class := Smalltalk globals at: each ifAbsent: [ nil ].
(class notNil and: [ environment includesClass: class class ])
ifTrue: [ aBlock value: class class ] ]
We already fixed it.
classesDo: aBlock
classes do: [ :each |
| class |
class := self environment at: each ifAbsent: [ nil ].
(class notNil and: [ selectedEnvironment includesClass: class ])
ifTrue: [ aBlock value: class ] ].
metaClasses do: [ :each |
| class |
class := self environment at: each ifAbsent: [ nil ].
(class notNil and: [ selectedEnvironment includesClass: class
class ])
ifTrue: [ aBlock value: class class ] ]
> - SelectorEnvironment>>#classesDo:
classesDo: aBlock
classSelectors keysDo: [ :each |
| class |
class := Smalltalk globals at: each ifAbsent: [ nil ].
(class notNil and: [ environment includesClass: class ])
ifTrue: [ aBlock value: class ] ].
metaClassSelectors keysDo: [ :each |
| class |
class := Smalltalk globals at: each ifAbsent: [ nil ].
(class notNil and: [ environment includesClass: class class ])
ifTrue: [ aBlock value: class class ] ]
again we already fixed it.
classesDo: aBlock
classes do: [ :each |
| class |
class := self environment at: each ifAbsent: [ nil ].
(class notNil and: [ selectedEnvironment includesClass: class ])
ifTrue: [ aBlock value: class ] ].
metaClasses do: [ :each |
| class |
class := self environment at: each ifAbsent: [ nil ].
(class notNil and: [ selectedEnvironment includesClass: class
class ])
ifTrue: [ aBlock value: class class ] ]
So does it make sense?
I think so.
We just have a common input for a given composite.
Stef