Repository navigation
OrchestrateLang v0.14.0
Arrays and structs cross the fastest boundary.
Added
-
Arrays and structs across the C ABI. C, C++, Zig, and Swift sidecars carried
int,
float,bool,string, andhandle; they now carryint[],float[],bool[], and
structs declared in the program.total(items: int[]) -> int scaled(items: float[], by: float) -> float[] shift(p: Point) -> PointAn array parameter is two C parameters — a pointer and a count, in that order. A
returned array adds one more, along long *the function writes the count through, and
returns the pointer. The ownership rule is the one strings already follow: what the
foreign side returns ismalloc'd, and the generated wrapper copies it and frees it; an
array parameter is borrowed for the call and must not be kept.A struct crosses by value, because generated structs are now
#[repr(C)]. Its fields
must line up with the foreign declaration, field for field and in order.Arrays carry
int,float, andbool. An array of strings, of handles, or of arrays
does not cross yet, and neither does a struct with those fields.
Changed
- Structs generated from a
structdeclaration are#[repr(C)], so their layout is the
one a foreign declaration sees. Nothing else about them changed.