Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.882.mcz==================== Summary ====================
Name: Collections-eem.882
Author: eem
Time: 11 March 2020, 7:01:02.481942 pm
UUID: e2b87321-4e8a-4f08-82f7-2ac8e0a5db99
Ancestors: Collections-eem.881
Make Symbols read-only at the VM level. Set read-onlyness in intern:. Use the package postscript to make all existing symbols read-only.
=============== Diff against Collections-eem.881 ===============
Item was changed:
----- Method: Symbol class>>intern: (in category 'instance creation') -----
intern: aStringOrSymbol
| originalNewSymbols |
originalNewSymbols := NewSymbols.
^(self lookup: aStringOrSymbol) ifNil:[
+ | aSymbol newNewSymbols |
- | aClass aSymbol newNewSymbols |
aStringOrSymbol isSymbol ifTrue:[
aSymbol := aStringOrSymbol.
] ifFalse:[
+ aSymbol := (aStringOrSymbol isOctetString ifTrue:[ByteSymbol] ifFalse:[WideSymbol])
+ new: aStringOrSymbol size.
- aClass := aStringOrSymbol isOctetString ifTrue:[ByteSymbol] ifFalse:[WideSymbol].
- aSymbol := aClass new: aStringOrSymbol size.
aSymbol string: aStringOrSymbol.
+ aSymbol beReadOnlyObject.
].
newNewSymbols := originalNewSymbols copyWith: aSymbol.
originalNewSymbols == NewSymbols
ifTrue: [
NewSymbols := newNewSymbols.
newNewSymbols size > 1000 ifTrue: [ self condenseNewSymbols ].
aSymbol ]
ifFalse: [
"Some other process has modified the symbols. Try again."
self intern: aStringOrSymbol ] ]!
Item was changed:
+ (PackageInfo named: 'Collections') postscript: '"below, add code to be run after the loading of this package"
+
+ "Make all Symbols read-only at the VM level"
+ Symbol allSubInstancesDo: [:s| s beReadOnlyObject]'!
- (PackageInfo named: 'Collections') postscript: 'Character initializeClassificationTable.
- HashedCollection rehashAll.'!