mem: typed allocation helpers + drop bare malloc/free (Phase 2.2); resolve 0119 as |>-contract clarification

This commit is contained in:
agra
2026-06-11 16:17:39 +03:00
parent 3e10809d7e
commit 84e0fb0752
51 changed files with 33256 additions and 32716 deletions

View File

@@ -2291,7 +2291,19 @@ p := Point.{3, 4};
print("{}\n", p.point_sum()); // calls point_sum(p) → 7
```
UFCS works with pointer receivers (auto-deref applies) and generic functions. If the field name exists as both a struct field and a free function, the struct field takes priority.
UFCS works with pointer receivers (auto-deref applies). Generic struct
*methods* dispatch via dot; a generic **free function** (any `$T` in its
signature) is NOT dot-rewritten — call it directly or fluently via the
pipe operator, which desugars at parse time to the direct call:
```sx
first_of :: (xs: []$T) -> T { xs[0] }
first_of(xs); // direct
xs |> first_of(); // fluent — desugars to first_of(xs)
```
If the field name exists as both a struct field and a free function, the struct field takes priority.
#### UFCS Aliases
The `ufcs` keyword creates a name alias for a function, decoupling the method name from the function name: