• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

strange grammar feature

 
Greenhorn
Posts: 21
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
(I'm a Groovy newbie)
by reading a groovy grammar (http://groovy.codehaus.org/jsr/spec/GroovyRecognizer.html#argument)
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 ...
any hint?
thanks
 
Greenhorn
Posts: 4
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Bernard!

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 http://marc.info/?l=groovy-user&m=126217908601838

Hope this helps!
Regards,
Serch
 
reply
    Bookmark Topic Watch Topic
  • New Topic