[swift-evolution] [Pitch] Add the DefaultConstructible protocol to the standard library

David Sweeris davesweeris at mac.com
Sun Dec 25 16:33:18 CST 2016

> On Dec 25, 2016, at 13:24, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> On Dec 25, 2016, at 12:54 PM, Adam Nemecek via swift-evolution <swift-evolution at swift.org> wrote:
>> Does enabling a lot of small improvements that make APIs more ergonomic count as practical?
> Yes, that would count as practical, but Xiaodi’s question is just as important.  *Which* APIs become more ergonomic?
> Here are a couple of more questions:
> 1) How does this square with Swift’s general philosophy to not default initialize values to “zero”?
> 2) To your original example, it isn’t immediately clear to me that reduce should choose a default identity.  Some types (e.g. integers and FP) belong to multiple different ring algebras, and therefore have different identity values that correspond to the relevant binary operations.

Would generic protocols solve #2? "func addStuff<T: Addable&HasIdentity<Addable>> (...) -> T {...}"? If so, does that affect the reasoning behind #1?

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161225/15d5f35f/attachment.html>

More information about the swift-evolution mailing list