groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edinson E. Padrón Urdaneta <edinson.padron.urdan...@gmail.com>
Subject Re: Invoking a method/closure/constructor with an arity equal to one without any argument doesn't fail
Date Tue, 01 Sep 2015 06:16:14 GMT
Thank you, blackdrag. I always can count on you.

Cheers.

On Tue, Sep 1, 2015 at 1:39 AM, Jochen Theodorou <blackdrag@gmx.org> wrote:

> you miss nothing. This is a logic I wanted to get rid of before Groovy 1.0
> already, but was said to be needed for some special constructs back then.
> And now you cannot easily remove it. But the static compiler does not
> support it, because in the longterm we want to get rid of it
>
> bye blackdrag
>
>
> Am 01.09.2015 08:02, schrieb Edinson E. Padrón Urdaneta:
>
>> Hi, everyone.
>>
>> I'm trying to understand why the following asserts hold
>>
>> // Method
>> def m(def x) { x }
>> assert m() == null
>>
>> // Closure
>> def c = { def x -> x }
>> assert c() == null
>>
>> // Constructor
>> class Klass {
>>      String msg
>>
>>      Klass(def x) {
>>          this.msg = "$x should be null"
>>      }
>> }
>> assert (new Klass()).msg == 'null should be null'
>>
>> The arity of the method/closure/constructor is one but I can call it
>> without any argument at all. What I'm missing?
>>
>> Thank you in advance.
>>
>
>
> --
> Jochen "blackdrag" Theodorou
> blog: http://blackdragsview.blogspot.com/
>
>

Mime
View raw message