next steps for first class iterators

This commit is contained in:
Araq 2012-11-26 02:43:32 +01:00
commit dd9ad9e497
7 changed files with 16 additions and 7 deletions

View file

@ -79,7 +79,7 @@ iterator count2(): int {.closure.} =
# a first class iterator has the type 'proc {.closure.}', but maybe
# it shouldn't:
proc invoke(iter: proc(): int {.closure.}) =
proc invoke(iter: iterator(): int {.closure.}) =
for x in iter(): echo x
invoke(count0)
@ -88,7 +88,7 @@ invoke(count2)
# simple tasking:
type
TTask = proc (ticker: int) {.closure.}
TTask = iterator (ticker: int)
iterator a1(ticker: int) {.closure.} =
echo "a1: A"