[Pharo-dev] methodDict versus methodDictionary

Stéphane Ducasse stephane.ducasse at inria.fr
Sun Dec 15 10:48:21 EST 2013

>> but I have 103 send of methodDict in my image 
> Yes, I am slowly removing them, but that takes time (I removed quite a lot over the last months! A *lot*!)

Ok excellent I did not know that.

> I even added a lint rule detecting calls to #methodDict.
>> So I do not get it and personally I would not deprecate methodDictionary and I would remove 
>> methodDict because it sucks!
> methodDict should *never* be used from the outside. It’s far too easy to get problems because you modify the dictionary
> without e.g. invalidating the VM cache or telling the system.
> And it gets *much* easier to read:
> methodDict values —> methods
> methodDict keys —> selectors
> methodDict size > 0 —> #hasMethods
> and so on… it’s amazing how much more readable code gets.
> So why do we provide a “nice” selector “methodDictionary” if this is a private accessor for internal state?
> If we do that it communicates “use me”! And you should not. If you want to use it, you know what you are doing
> and you know #methodDict.

I disagree here. In that case we should start using vv jyv jvzxxx.
We should put the method in a private category and we should add a comment.

> And if people use it, the #methodDict is so deep in the brain of people that they never used #methoDictionary
> (there where maybe 5 senders…).

Still I would rename it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20131215/692fd6ed/attachment-0002.html>

More information about the Pharo-dev mailing list