interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tests / compiler / progs / bounds.osc

13 lines · 342 bytes Raw Blame History
1// entry: get set_get
2// dynamic indexes: out-of-range traps BOUNDS (negative signed indexes too).
3fn get(i: i8) -> i16 {
4 let a: own [i16; 10] = alloc(5);
5 for k in 0 .. 10 { a[k] = (k as i16) * 3; }
6 return a[i];
7}
8
9fn set_get(i: u16, j: i32, v: i16) -> i16 {
10 let a: own [i16; 12] = alloc(-1);
11 a[i] = v;
12 return a[j];
13}