lang: for-loop by-ref element capture (for xs: (*x))

(*x) binds x to a pointer into the collection (index_gep) instead of a per-element value copy: passing it on (e.g. to a *T param) is zero-copy and mutations write back. In a value position x auto-derefs — a binary-op operand loads the element, a pointer-typed slot keeps the pointer, and an 'if x == {...}' match derefs the pointee for its tag/payload. Arrays GEP through their storage so writes hit the original. Regression test: examples/for-by-ref-capture.sx.
This commit is contained in:
agra
2026-05-31 10:29:16 +03:00
parent 4415274894
commit 185df9afb7
6 changed files with 88 additions and 10 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
101 102 103
circle 2.000000
none