Do you have a link to that research? I'd be very interested.
> On Mar 19, 2016, at 11:46 AM, Tino Heth via swift-evolution > <[email protected]> wrote: > > >> Can't quite see where "Inheritance for structs / "newtype"-feature" >> enables this, however. Care to explain? > It's not required, but unless you want to implement a completely new numeric > type (like fractions), it is tedious to declare all operations and > conversions that are useful or required: > > struct CustomDouble { > let value: Double > } > > func == (a: CustomDouble, b: CustomDouble) -> Bool { > return abs(a.value - b.value) < 0.01 > } > > This type can handle the comparison, but actually, you don't want a struct > that contains a double, but that is a double (and inherits all abilities of > this type). > Greg Titus already did some research and made the observation that such > simple container-types have no memory or performance penalty, but as a > developer, you have to write many stupid functions that do nothing but > forwarding operations on x to x.value… > > Tino > _______________________________________________ > 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
