diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-01-19 19:02:44 +0000 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-01-19 19:02:44 +0000 |
| commit | 563b1e2b285e788338aecfa9f3d6536fb9516fd0 (patch) | |
| tree | 8ea1f852f89ee765da94dab334b9a2efbec31cdc /code | |
| parent | 4603d2525ebdfa57522ec60db4a86cbc99251ee5 (diff) | |
`immutable` field prefix
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/code/demo.odin b/code/demo.odin index 4b4781323..272ef0ec2 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -10,6 +10,13 @@ #import "utf8.odin"; main :: proc() { + T :: struct { x, y: int } + foo :: proc(using immutable t: T) { + a0 := t.x; + a1 := x; + x = 123; // Error: Cannot assign to an immutable: `x` + } + // foo :: proc(x: ^i32) -> (int, int) { // fmt.println("^int"); // return 123, int(x^); |