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

Allow Closures to be lazily evaluated in GStrings

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1-beta-1
    • Component/s: groovy-jdk
    • Labels:
      None

      Description

      When a Closure is a value in a GString do the following when the GString is printed or has toString called on it.

      If the Closure takes 0 parameters then call the Closure and use the returned value as the value at that point in the GString

      If the Closure takes 1 parameter then call the Closure with a Writer as the parameter and use the characters written to the Writer as the value at that point in the GString

      If the Closure takes more that one parameter throw a GroovyRuntimeException.

        Attachments

          Activity

            People

            • Assignee:
              tug John Wilson
              Reporter:
              tug John Wilson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: