Identity Dictionary - Is this possible?

Until you give it a name used by a method in any of the following classes…
[class Event, class Environment, class IdentityDictionary, class Dictionary, class Set, class Collection, class Object ]

e.g.

(
var dict = (
	numChannels: { |self, string|
		'This is never called with hello'.postln;
		self.postln;
		string.postln;
	}
);

dict[\numChannels].value("world"); 
// prints:
//    This never called with hello
//    world
//    nil

dict.numChannels("hello");   
// prints:
//   1
)
1 Like