SE-0519: Borrow and Inout types for safe, first-class references

That sounds reasonable, given the accepted direction in SE-0507 to use borrow and mutate as the keywords for accessors.

As others have expressed in this thread, the inout keyword on parameters is problematic in the language today. It can mean “copy-in copy-out” this value (for Copyable parameters) or “mutably borrow” this value (for ~Copyable parameters). When reading a function signature, the copyability of a type is not readily apparent, so inout is a bit ambiguous. For SE-0519, tying the “mutable reference” meaning to Inout feels like building on muddy ground.

I actually discuss this further in my pitch, and would advocate for pushing inout to its original “copy in copy out” semantics over time, and favor a new keyword like mutating for parameters to mean “mutably borrow”, regardless of the copyability of the argument.

3 Likes