an "intuitive" error message
Frank Mueller
frank at mweb.de
Mon Jul 4 11:35:22 UTC 2005
Nope, the block accepts one.
[ :foo | ... ]
can only be called with one argument, not two or more. But
keysAndValuesDo: aBlock
calls it with two. The first is the key, the second is the value. It calls
aBlock value: key value: value.
The error is signaled by the block.
Regards
mue
> So, it should read;
>
> "Error: This block accepts 2 arguments, but was called with 1"
>
> ;-)
>
>
> Frank Mueller skrev:
>
>>Hmm, I don't see the problem.
>>
>>The block [ :each | ... ] accepts only one argument, named "each". But keysAndValuesDo:
>>delivers two arguments. So the tight way would be
>>
>>Dictionary new at: 1 put: 1; keysAndValuesDo: [:key :value | ... ].
>>
>>Regards
>>
>>mue
>>
>>
>>
>>>Lets start monday morning with an intuitive error message:
>>>
>>> Dictionary new at: 1 put: 1; keysAndValuesDo: [:each | ].
>>>
>>>"Error: This block accepts 1 argument, but was called with 2"
>>>
>>>
>>
>>
>>
>
>
>
>
--
**
** Frank Mueller / Oldenburg / Germany
**
** frank at mweb.de / http://frank.mweb.de
**
More information about the Squeak-dev
mailing list
|