3 ms·
You still have local reasoning with struct semantics. You are not giving that up in exchange for performance, you get both. func newStructValue(s: Struct) ->
by amw-zero 5y ago
You still have local reasoning with struct semantics. You are not giving that up in exchange for performance, you get both.
func newStructValue(s: Struct) -> Struct {
s.value = 5
return s
}
The reasoning for this block of code is totally local to the function body. Because the only reference to `s` is in the body of the function - it cannot be more local than that.