links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Environment initialize
Last updated at 1:10 pm UTC on 28 October 2016
[squeak-dev] The Inbox: Environments-nice.66.mcz
Add star 
<commits@source.squeak.org>	Fri, Oct 28, 2016 at 2:14 PM
Reply-To: squeak-dev@lists.squeakfoundation.org
To: squeak-dev@lists.squeakfoundation.org

Nicolas Cellier uploaded a new version of Environments to project The Inbox:

==================== Summary ====================

Name: Environments-nice.66
Author: nice
Time: 28 October 2016, 2:13:59.156947 pm
UUID: 93464b3f-60d7-d646-96a4-c7315b2cff73
Ancestors: Environments-nice.65

Make the undeclared dictionary point weakly to its bindings so as to reduce namespace pollution and minimize the impact of yet to be solved undeclared bugs.

This requires the WeakIdentityDictionary class defined in Collections-nice.723

=============== Diff against Environments-nice.65 ===============

Item was changed:
  ----- Method: Environment>>initialize (in category 'initialize-release') -----
        declarations := IdentityDictionary new.
        bindings := IdentityDictionary new.
+       undeclared := WeakIdentityDictionary new.
-       undeclared := IdentityDictionary new.
        policies := Array new.
        observers := IdentitySet new.!

Item was added:
+ ----- Method: Environment>>makeUndeclaredWeak (in category 'private') -----
+ makeUndeclaredWeak
+       "This message is for transition only"
+       | weakUndeclared |
+       undeclared class = WeakIdentityDictionary ifTrue: [^self].
+       weakUndeclared := WeakIdentityDictionary new: undeclared size.
+       weakUndeclared addAll: undeclared associations.
+       undeclared becomeForward: weakUndeclared!

Item was changed:
+ (PackageInfo named: 'Environments') postscript: '"Undeclared should point weakly to its bindings
+ so as to reduce namespace pollution."
+ Environment allInstancesDo: [:e | e makeUndeclaredWeak].
+ Smalltalk garbageCollect.
- (PackageInfo named: 'Environments') postscript: '"It''s impossible to import a binding if not exported.
- There''s nothing secret in Smalltalk (nor private)."
- Smalltalk globals exportSelf.