The Inbox: Environments-nice.66.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Environments-nice.66.mcz

commits-2
Nicolas Cellier uploaded a new version of Environments to project The Inbox:
http://source.squeak.org/inbox/Environments-nice.66.mcz

==================== 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') -----
  initialize
  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.
  '!