Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-21

.. as a new binary operator

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • 1.1-beta-2
    • lexer
    • None

    Description

      Rather than having a special RangeExpression 0..5 we could just make .. an operator.

      Then the .. operator on numbers could create a range and we can use this operator to do a 'traverse' on other objects. E.g. we can use .. to be like // in XPath.

      e.g.

      node = builder.foo() {
      bar()

      { x("a") x("b") }

      }
      node..x

      would yield [ x("a"), x("b") ]

      We could also use .. to invoke methods on collections of objects too.

      node..x..name() would yield ["a", "b"]

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              jstrachan James Strachan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: