code wiki / (root) / nx_probe_closure_named.nx

nx_probe_closure_named.nx source

↩ module page · 16 lines · 661 B

1// nx_probe_closure_named.nx -- LN13b DISCRIMINATION CONTROL: the pre-existing bare-function-name 2// and &name paths must still compile after the literal lands. 3// 4// Without this, a compiler that refused EVERY func-typed construct would score full marks on the 5// capture refusal above. It is the positive half of the deny-guard pair the estate requires. 6// license_tier: ORIGINAL. No hw writes (Rule 26). 7 8func pcn_double(x: i64) -> i64 { return x + x } 9 10func main(argc: i64, argv: **u8) -> i64 { 11 let a: func(i64) -> i64 = pcn_double 12 let b: func(i64) -> i64 = &pcn_double 13 if a(21) != 42 { return 1 } 14 if b(21) != 42 { return 2 } 15 return 0 16}