A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
strange grammar feature
Joined: May 15, 2009
May 04, 2011 02:23:41
(I'm a Groovy newbie)
by reading a groovy grammar (
I do not understand the "argument" production
apparentlty there may be something like "*:" as a label .... seen nothing on the web to explain the meaning of that ...
Joined: Aug 28, 2011
Aug 30, 2011 13:10:53
Nice question!, *. operator is used to spread all elements in a list...
assert ['cat', 'elephant']*.size() == [3, 8]
while *: is used to spread or combine maps, so you could do something like this:
def argMap = [b:2, c:3, d:4]
fancyMethod(a:1, *:argMap) // You can see this complies the "argument" production in the groovy grammar
You could also see this link
Hope this helps!
I agree. Here's the link:
subject: strange grammar feature
Welcome Dierk Koenig
Why interpreter is the pattern?
Incorect operations order when implementing math parser with JavaCC
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014