[squeak-dev] Wrong error message from BlockClosure ?

Levente Uzonyi leves at elte.hu
Thu Apr 30 12:52:25 UTC 2015


Try #groupsDo: :)

Levente

On Thu, 30 Apr 2015, karl ramberg wrote:

> #(1 2) do:[:a :b| b] "do it"
> 
> Error: 'This block accepts 2 argument, but was called with 1 arguments.'
> 
> Should not the numArgs and the numArgsForInvocation switch place here ?
> 
> BlockClosure>>numArgsError: numArgsForInvocation
> 
> | printNArgs |
> printNArgs := [:n| n printString, ' argument', (n = 1 ifTrue: [''] ifFalse:['s'])]. 
> self error: 
> 'This block accepts ', (printNArgs value: numArgs), 
> ', but was called with ', (printNArgs value: numArgsForInvocation), '.'
> 
>


More information about the Squeak-dev mailing list