Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4384 Implement GEP-3: extended command expressions
  3. GROOVY-4403

GEP-3: disambiguate cases where minus something or [] or {} are used as the argument of extended command expressions

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.8-beta-4
    • parser-antlr2
    • None

    Description

      Usual command expressions (ie. one method and its arguments) cannot disambiguate something like:

      println -1    // println( -1 )  ???
      println [1]   // println( [1] ) ???
      

      As they could be interpreted also as:

      variable - 1  // a substraction
      variable[1]   // a subscript access
      

      However, in the case of extended command expressions, we could find out:

      counting 0..10 above -1 gives 11
      counting -1..1 above 0 gives 1
      

      Other examples with curly braces and square brackets:

      given {} when {} then {}
      pick { it % 2 == 0 } from [1, 2, 3, 4, 5, 6] into [] // put the even numbers from a list into another one
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: