On Mar 25, 2007, at 11:56 AM, John Kubie wrote:

>
> On Mar 25, 2007, at 11:28 AM, Charles Yeomans wrote:
>
>>>
>>> If I were to try say what the second line is doing it is something
>>> like:
>>> "get the value associated with the key "name" from myDictionary and
>>> assign it to "myvariable".
>>>
>>> If the second line were:
>>>     myvariable=mydictionary.KEY("name")
>>> it would make more sense to me.
>>
>> But it would be wrong.  mydictionary.value returns the value
>> associated to the key passed as the parameter.  You described it
>> correctly above.
>
> I was making up the syntax, without a lot of thought. But the point
> is that the 'correct' line doesn't have the word "key" in it, so this
> must be implicit knowledge. It's more difficult. And making a
> grammatical sentence of it is not easy.
>
> An applescript-type syntax might be
>
>       "get the value associated with the key name from mydictionary"

And this is the way to read the REALbasic code

return d.Value(key).

>
> While wordy, this is a sentence I can read.
>
> Another problem with dictionaries: the word 'dictionary'. While an
> adequate description of how things are stored and accessed, the name
> hides the power.
> A novice is frequently scared of doing things wrong and getting into
> traps. This novice would be hesitant to use a dictionary as a not-
> obvious general method for returning
> multiple values from a method. If a dictionary were called something
> like a "pairedValueHolder" its general utility might be more obvious
> (not a serious suggestion).


I think most people understand how a dictionary works in the  
vernacular sense -- it's a collection of words, plus meanings and  
other information for each word.  I think calling it a "Key-Value  
Set" would be more confusing to most people, though it's still not  
precise enough because set identity is defined by the value of the  
key alone.  So even better would be to call it a "Function Graph",  
because everyone knows what this means from algebra :)

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to