diff options
Diffstat (limited to 'lib/std/with.nim')
-rw-r--r-- | lib/std/with.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/std/with.nim b/lib/std/with.nim index c1ac96fcb..ea26065a1 100644 --- a/lib/std/with.nim +++ b/lib/std/with.nim @@ -41,6 +41,7 @@ when isMainModule: type Foo = object col, pos: string + name: string proc setColor(f: var Foo; r, g, b: int) = f.col = $(r, g, b) proc setPosition(f: var Foo; x, y: float) = f.pos = $(x, y) @@ -49,3 +50,9 @@ when isMainModule: with(f, setColor(2, 3, 4), setPosition(0.0, 1.0)) echo f + f = Foo() + with f: + col = $(2, 3, 4) + pos = $(0.0, 1.0) + _.name = "bar" + echo f |