Published
Region-safe functions in Jik v0.1.0-alpha.13
Jik now identifies user-defined functions that are region-safe. Calls to these functions no longer need to satisfy the same-region rule, so read-only helpers and similar functions can naturally accept composite values from different regions while preserving Jik's region-safety guarantees.
The compiler infers this property from the function body. If a function stores a value from one parameter region into another, or if it returns a composite value, it remains subject to the same-region rule.
func compare(left: String, right: String):
println(left, right)
end
func demo(r: Region):
x := "local"
compare(x, "other"[r]) // OK: `compare` is region-safe
end
This removes the need to mark ordinary read-only helpers with
foreign solely to accept data from different regions. Unsafe
cross-region stores still require an explicit copy into the destination
region.
Read more: Revised memory management documentation Release: Jik v0.1.0-alpha.13