Last updated at 1:10 pm UTC on 28 October 2016
[squeak-dev] The Inbox: Environments-nice.66.mcz
<firstname.lastname@example.org> Fri, Oct 28, 2016 at 2:14 PM
Nicolas Cellier uploaded a new version of Environments to project The Inbox:
==================== Summary ====================
Time: 28 October 2016, 2:13:59.156947 pm
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') -----
+ "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.