ObjectWrapper has no way to conform to SDK private / internal protocols and therefore such design can easily cause unexpected behavior, because wrapper casting to private protocols fails.
There are also newtypes topics previously discussed. This is a more common feature for addressing these needs:
newtype has come up again and since I don't have a specific pitch I thought I'd start some discussion outside of the older thread. Before diving into specific syntax or implementation details I think it would be good to gather ideas about what people want out of such a feature and what they feel is most important.
Personally, I'm a fan of starting with simpler newtype behavior: newtypes inherit all of the functionality and conformances of the original type, but are considered separate types. De…
The OP did state it would be 'semantically' similar to a struct with a value, but it doesn't have to be exactly equivalent to that. I'm no expert, but perhaps it would be possible for the compiler to fudge the access level so that we could have the RawRepresentable conformance while still hiding the internally stored value?
Of course, part of the pitch does state Int is not a RecordId and having RawRepresentable with the copied type would break that wouldn't it?
It also may be against the goa…
2 Likes