>>>>> "Levente" == Levente Uzonyi <[email protected]> writes:

Levente> Here is a working example (the linked version has a bug):
Levente> BlockClosure >> cull: argument1 cull: argument2

Levente>        numArgs = 2 ifTrue: [ ^self value: argument1 value: argument2 ].
Levente>        numArgs = 1 ifTrue: [ ^self value: argument1 ].
Levente>        ^self value

The error message here will be misleading if it's a 3 arg block,
saying that it wants 3 args, but was given 0, when in fact you *offered*
two args.

Perhaps the tests could be done in the reverse order:

    numargs = 0 ifTrue: [^self value].
    numargs = 1 ifTrue: [^self value: argument1].
    ^self value: argument1 value: argument2.

Then, you'll get a sensible message... "offered 2, wanted 3"


-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to