Details
-
Type:
Task
-
Status:
Closed
-
Priority:
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 :
Description
add yield keyword to support continuations.
e.g.
// simple way to implement an iterator
foo()
// or
foo() {
for i in bar {
if i.whatnot == 7
}
}
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'