[FIX] Re: Dictionary initialization syntax

Andrew P. Black black at cse.ogi.edu
Fri Dec 8 20:24:08 UTC 2000


At 10:10 +1300 00.12.08, Richard A. O'Keefe wrote:
>"Andrew P. Black" <apb at cse.ogi.edu> wrote:
>	Well, Dictionary Class >> newFrom: aDictOrArray contains a couple of
>	examples of ways to do, this, namely
>
>		Dictionary newFrom: {1->#a. 2->#b. 3->#c}
>		{1->#a. 2->#b. 3->#c} as: Dictionary
>
>	But the comments and argument name in that method were such that you
>	were unlikely to find it.
>
>I think that's a little unfair.
>If you want to know how to make a Dictionary,
>the obvious thing to do is to point the browser at that class,
>and look at class methods for instance creation.
>
>There is only one.

You are right, I mis-spoke.  It is reasonable to expect people to 
find Dictionary >> newFrom:.  The point that I was rather sloppily 
trying to make is that, having found that method and having read it, 
most people would not realize that the argument could be an array. 
The argument is named "aDict" and the comment refers to it as a 
dictionary.  If you read the code, you will see that the message 
associationsDo: is sent to aDict.

What I was trying to claim in my previous mail is that the fact that 
"Dictionary newFrom: aDict" actually works fine if the argument is an 
array of associations is not at all obvious, based on the fact that 
it wasn't obvious to me, or evidently to Mark.  I don't think that I 
was being unfair in this claim: stupid, maybe, shortsighted, almost 
certainly, but unfair ... ?

Anyway, I don't see that any harm can be done by making the argument 
name and the comment a bit more accurate, which is what my "fix" 
attempted to do.   I didn't change the code at all.

My other claim is that SequenceableCollection>>asDictionary is weird; 
I'd love to see a justification for it, though.

		Andrew





More information about the Squeak-dev mailing list