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/

Reply via email to