Created
July 17, 2018 15:17
-
-
Save GULPF/72fb92717d83f194c3c8c835d72051a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typetraits | |
iterator foo(i: int): int {.closure.} = | |
yield i + 1 | |
yield i + 2 | |
let f = foo | |
echo f(1) # 2 | |
echo f(2) # 4 | |
when false: | |
echo foo() # Error: attempting to call undeclared routine: 'foo' | |
echo type(f) # iterator (i: int): int{.closure, noSideEffect, gcsafe, locks: 0.} | |
echo type(foo) # iterator (i: int): int{.closure, noSideEffect, gcsafe, locks: 0.} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment