jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
groovy
  • groovy
  • GROOVY-10

yield keyword

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Task Task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0-beta-3
  • Component/s: ast builder, lexer, parser
  • Labels:
    None
  • Number of attachments :
    0

Description

add yield keyword to support continuations.

e.g.

// simple way to implement an iterator
foo()

{ yield 1; yield 2; yield 3; }

// or
foo() {
for i in bar {
if i.whatnot == 7

{ yield i; }

}
}

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
james strachan added a comment - 27/Oct/03 6:14 AM

We can achieve the same yield functionality via using closures. e.g.

foo(yield) {
yield.call(1234)
yield.call('hello')
}

If we had neater syntax sugar for calling closures we could make this look like

yield(123)
yield('abc')

or if parentheses are optional...

yield 123
yield 'abc'

Show
james strachan added a comment - 27/Oct/03 6:14 AM We can achieve the same yield functionality via using closures. e.g. foo(yield) { yield.call(1234) yield.call('hello') } If we had neater syntax sugar for calling closures we could make this look like yield(123) yield('abc') or if parentheses are optional... yield 123 yield 'abc'

People

  • Assignee:
    bob mcwhirter
    Reporter:
    bob mcwhirter
Vote (0)
Watch (0)

Dates

  • Created:
    25/Sep/03 5:53 PM
    Updated:
    27/Oct/03 6:14 AM
    Resolved:
    27/Oct/03 6:14 AM

Time Tracking

Estimated:
2h
Original Estimate - 2 hours
Remaining:
2h
Remaining Estimate - 2 hours
Logged:
Not Specified
Time Spent - Not Specified
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.