> Am 05.01.2016 um 17:11 schrieb Grzegorz Adam Hankiewicz via swift-evolution 
> <[email protected]>:
> 
> The ideal would be for the compiler to pretend Euros or RefTablePk are 
> different types, yet use their parent type at the binary level. This needs a 
> specific syntax to teach the compiler which existing methods/operations are 
> allowed on the new fake types and which aren’t. These new distinct types 
> would *borrow* previous implementations.

What about citing the relevant protocols in the newtype definition? This should 
include the ability to use my own protocols to which I have made the underlying 
type conform to by an extension.

Throwing some syntax into the discussion:

newtype Euro = Double : Addable, Subtractable

where I have defined the protocols Addable and Subtractable somewhere and made 
Double conform to them if all this is not provided by the standard library.
The implementation of Euro then borrows the implementation of Double for these 
protocols.

-Thorsten 
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to