(Excuse me, my last reply was sent prematurely) As I was saying, I agree with the overall usefulness of newtype-style declarations, but I don’t understand why we need so much syntax for what should just be a pattern in Swift. Specifically, the idea of automatic delegation of an interface is antithetical to the very reason why Haskell has newtype in the first place. And in the situations in which I would create an alternate definition of a type, I expect to never inherit the interface of the underlying type because I intend for it to be completely distinct.
Additionally, the use of inheritance in alternate definitions seems out of place and the casting section breaks encapsulation. ~Robert Widmann > On Jul 29, 2017, at 4:01 PM, Daryle Walker via swift-evolution > <[email protected]> wrote: > > Proposal at > <https://gist.github.com/CTMacUser/c493f775075e946efdcfd85d38473291 > <https://gist.github.com/CTMacUser/c493f775075e946efdcfd85d38473291>>, > uploaded revision 4. > > Changes: > > Since the original setup was a poor copy of how raw-style enumerations use > RawRepresentable, changed the model to actually use RawRepresentable. > Actually, it uses a sub-protocol, AnyAlternative, which adds an associated > type for the implementing non-alternative type. AnyAlternative also serves a > function like AnyObject. > Removed the old library support type since it’s obsolete. Added back a (now > global) function to upcast to the implementation type without needing to name > it. > Added option to initialize alternative by assigning to “super.” Using “super” > by itself isn’t allowed in the grammar (It has to be followed by a member > specification), so I added it. > Added note about pointer compatibility. > The model change led to a lot of rewording. And new/changed technical terms. > > — > Daryle Walker > Mac, Internet, and Video Game Junkie > darylew AT mac DOT com > > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
