an "intuitive" error message

Avi Bryant avi.bryant at gmail.com
Mon Jul 4 12:12:03 UTC 2005


On Jul 4, 2005, at 1:46 PM, Chris Schreiner wrote:


> I understand this now. But I dont think the error message is  
> *helping* me to understand it.
>

I have to say, I also always have to think for a second when I get  
this error message, even though it's certainly correct.

What about something like "Error: Dictionary>>keysAndValuesDo: was  
expecting a block with 2 arguments, but this block only accepts 1".

Note that I'm not saying that #keysAndValuesDo: was expecting to be  
*passed* a block with 2 arguments - the block doesn't know how it got  
there, it could have been passed to some other method at some other  
time and stored somewhere, and then used later by #keysAndValuesDo:.   
But we do know that #keysAndValuesDo: somehow has a block and is  
expecting it to accept 2 args, and in *most* cases that will also  
help to find which message send got the wrong kind of block as an  
argument as well.

Avi

>> 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"
>>



More information about the Squeak-dev mailing list