Hi all,

In Groovy, when optional parenthesis for a function that takes a map
are removed, Groovy thinks you're trying to index by a map if you
don't omit the square braces.

This just seems like a Groovy bug to me (and Hans as well),
so I filed a JIRA on it today.

See:     http://jira.codehaus.org/browse/GROOVY-3392

There's more info in the JIRA, but here's the upshot:

void moo(a,b) { println "moo:  $a $b"     }
void cow(a,b) { println "cow:  $a.x $b.x" }
void yow(a)   { println "yow:  $a.x"      }

moo("fun", "sun")              // case 1:  WORKS -- should work
moo "fun", "sun"               // case 2:  WORKS -- should work

cow([x:"fun"], [x:"sun"])      // case 3:  WORKS -- should work
cow  x:"fun" , [x:"sun"]       // case 4:  WORKS -- should work
cow [x:"fun"], [x:"sun"]       // case 5:  FAILS -- but this should work!

yow([x:"fun"])                 // case 6:  WORKS -- should work
yow  x:"fun"                   // case 7:  WORKS -- should work
yow [x:"fun"]                  // case 8:  FAILS -- but this should work!

-- 
View this message in context: 
http://www.nabble.com/GROOVY-3392-----optional-function-parenthesis-and-maps-tp22312228p22312228.html
Sent from the gradle-user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to