immutable field prefix

This commit is contained in:
Ginger Bill
2017-01-19 19:02:44 +00:00
parent 4603d2525e
commit 563b1e2b28
7 changed files with 89 additions and 67 deletions

View File

@@ -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^);