Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tests/compiler/progs/structs_dtor.osc # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / compiler / progs / structs_dtor.osc` 19 lines ยท 680 bytes Raw Blame History 1 // entry: dtor 2 // OSC-2 structs: deterministic destruction. Owners are released at scope 3 // end in reverse declaration order, structs and arrays alike, using the same 4 // alloc/release events as arrays. A moved-from struct is not released again. 5 // The release order is asserted by test_osc_compiler (serials 3 2 4 1). 6 struct Pair { a: u32, b: u32 } 7 8 fn dtor(k: u32) -> u32 { 9 let p: own Pair = Pair { a: k, b: 1 }; 10 { 11 let arr: own [u32; 2] = alloc(2); 12 let q: own Pair = Pair { a: arr[0], b: arr[1] }; 13 p.b = q.a + q.b; 14 } 15 let r: own Pair = Pair { a: 9, b: 9 }; 16 let s: own Pair = r; 17 return p.a + p.b + s.a; 18 } 19 // expect-run: dtor 1 -> 14