tinterf.nim works now

This commit is contained in:
Araq 2012-06-17 02:11:13 +02:00
commit 7076f07228
4 changed files with 54 additions and 17 deletions

20
tests/run/tinterf.nim Normal file
View file

@ -0,0 +1,20 @@
discard """
output: '''56'''
"""
type
ITest = tuple[
setter: proc(v: int) {.closure.},
getter: proc(): int {.closure.}]
proc getInterf(): ITest =
var shared: int
return (setter: proc (x: int) = shared = x,
getter: proc (): int = return shared)
var i = getInterf()
i.setter(56)
echo i.getter()