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
omega-mv / seed / omc / tests / struct-bool / param_view.om
| 1 | note param_view.om: a bool field read through a view parameter in a helper that returns a number. |
| 2 | note true counts 2 and false counts 1 for each of two structs, plus the numbers: 2 + 1 + 20 + 30. |
| 3 | struct W a uint f bool end |
| 4 | fn weight v view W to uint |
| 5 | if eq get v f true |
| 6 | ret add 2 get v a |
| 7 | end |
| 8 | ret add 1 get v a |
| 9 | end |
| 10 | fn main to uint |
| 11 | p = new W 20 true |
| 12 | q = new W 30 false |
| 13 | ret add weight p weight q |
| 14 | end |