Javadoc
If the sole argument is a map, its [...] bracket cannot be present.
Historically we've disambiguated this by adding (...) around the function call.
TODO: I claim removing both () and [] would be better.
% groovysh
Groovy Shell (2.0.2, JVM: 1.7.0_07)
Type 'help' or '\h' for help.
---------------------------------------------------------------------------------------------------------------------------------------------
groovy:000> def foo(o) { println o }
===> true
groovy:000> foo abc:1, def:2
[abc:1, def:2]
===> null
groovy:000> foo(abc:1, def:2)
[abc:1, def:2]
===> null
groovy:000> foo [abc:1,def:2]
ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed:
groovysh_evaluate: 2: No map entry allowed at this place
. At [2:9] @ line 2, column 9.
foo [abc:1,def:2]
^
1 error
at java_lang_Runnable$run.call (Unknown Source)
groovy:000> foo([abc:1,def:2])
[abc:1, def:2]
===> null