--- a/MethodDictionary.st Sun Mar 03 11:27:12 2019 +0100
+++ b/MethodDictionary.st Sun Mar 03 15:59:58 2019 +0100
@@ -17,7 +17,7 @@
KeyedCollection variableSubclass:#MethodDictionary
instanceVariableNames:''
- classVariableNames:''
+ classVariableNames:'EmptySingleton'
poolDictionaries:''
category:'Kernel-Methods'
!
@@ -62,6 +62,22 @@
!MethodDictionary class methodsFor:'instance creation'!
+new
+ "create and return an empty methodDictionary.
+ Because mDicts cannot grow, we return a singleton
+ (if any selectors are added later, a new instance
+ will be created anyway).
+ Using a singleton will speed up dynamic creation of
+ new classes which will be filled in later"
+
+ EmptySingleton isNil ifTrue:[
+ EmptySingleton := super new.
+ ].
+ ^ EmptySingleton
+
+ "Created: / 03-03-2019 / 15:27:43 / Claus Gittinger"
+!
+
new:sz
"create and return a new methodDictionary holding sz
key->value associations"