I will mention it as a important alternative in the RFC. Changing a type to non-Copy is a massive backcompat problem due to the change in the semantics of assignment and binding in general.
I think there are two important points which make me lean towards automatically applying to not making Reinterpret
opt-in:
- Adding a private field to a struct with all public members is already non-backcompat because you’re making the ‘constructor’ private: i.e. I won’t be able to write
MyStruct { field1: 10, field2: "asdf" }
anymore. Therefore, if you want to leave the door open to private fields, you’ll have to add a dummy private field e.g._dummy: ()
anyway. - If you buy (1) and accept that a
Public
type has already commited to staying that way, then applyingReinterpret
without explicit opt-in feels like a small leap: all the functions defined on aReinterpret
type could be manually implemented with safe code. They’re just fancy ways of setting the values of public fields.
That said, I’m sympathetic to backcompat worries, so, like I said, I’ll make sure this gets the right amount of space in the RFC.