I read how we can omit parenthesis and dots to use groovy as a DSL. Due to which thought that task
is a method.
But I'm confused if task
is a method of the form def task(String name, Closure closure)
. Then a task would be declared in DSL as task "taskname", {}
. But actually, it is task taskname {}
.
Why doesn't groovy misinterpret taskname
as a variable name here? And if task
is not a method what is it?