an "intuitive" error message
Michael Roberts
mike at mjr104.co.uk
Mon Jul 4 19:38:52 UTC 2005
Hi all,
I think I changed this error message a few years ago. I'm fairly sure
that I was confused every single time I got the original message
--> This block requires 1 arguments
because I used to think, 'yeh, I've declared it with one argument!'
So I changed it to be from the block's point of view
--> This block expects 1 argument but was called with 2
If it's still confusing people then maybe it can be rewritten once and
for all!
I can't remember exactly what was going on in my mind at the time but
I'm sure that I had earlier versions that were more verbose. I think I
tried to cut down the width of the message since it didn't always print
in the default width of the debugger window.
I'm not sure I'm in the best position to come up with something better
but my 2p would be
--> Incorrect number of block arguments. Block expects 1 but is passed 2.
I think I would still write it from the block's POV because the block
signals the error. I think Avi is suggesting more from the sender's POV:
Avi Bryant wrote:
>
> What about something like "Error: Dictionary>>keysAndValuesDo: was
> expecting a block with 2 arguments, but this block only accepts 1".
>
which is quite nice, but how do you generate the string? Do you walk
the sender chain to find which method evaluated the block?
Anyway, a fun little puzzle. Would "Incorrect number of block
arguments" be a touch minimal?
Cheers
Mike
More information about the Squeak-dev
mailing list
|