<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 16. Jul 2017, at 16:26, Dave Abrahams via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">on Sun Jul 16 2017, Jens Persson &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class="">On Wed, Jul 12, 2017 at 12:23 AM, Dave Abrahams via swift-evolution &lt;<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class="">/../<br class="">As ever, my first question when a new protocol is proposed is, “what<br class="">generic algorithms rely on this protocol?”<br class=""><br class=""><br class=""></blockquote>First, please note that I made some mistakes in the code earlier in this<br class="">conversation as I did not have a compiler at hand, a better version can be<br class="">found in the PS-section of this post:<br class=""><a href="https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20170710/005921.html" class="">https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20170710/005921.html</a><br class=""></blockquote><br class="">Looking closer at your proposal, it appears to be representing in the<br class="">language the notion of a trivial type:<br class=""><br class=""><a href="https://github.com/apple/swift/blob/2ee382efc37bc8ca2fc41495e76bd07846e6ca93/docs/ABIStabilityManifesto.md#layout-and-properties-of-types" class="">https://github.com/apple/swift/blob/2ee382efc37bc8ca2fc41495e76bd07846e6ca93/docs/ABIStabilityManifesto.md#layout-and-properties-of-types</a><br class="">https://github.com/apple/swift/blob/b6ce00a012acc3f16f9d1758320fe926a92f0dd3/docs/OwnershipManifesto.md#core-definitions<br class=""><br class="">That's definitely something we should do in order to support low-level<br class="">programming.<br class=""><br class=""><blockquote type="cite" class=""><br class="">It contains some more context also.<br class=""><br class="">To answer your question: I'm using it as one of the basic building blocks<br class="">needed for implementing generic statically allocated Vector types with<br class="">type-level Element and Count/Index (despite the current limitations of<br class="">Swift's type system!) , <br class=""></blockquote><br class="">Yes, Michael Ilseman and I have solved the same problem in several ways<br class="">ourselves. &nbsp;Of course the particular problem of fixed-sized arrays<br class="">should probably have native support, but a builtin way to identify<br class="">trivial types at compile-time would be helpful as well.<br class=""><br class="">-- <br class="">-Dave<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class="">swift-evolution@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""><div class="">+1 to that. @_specialized supports layout constraints. We should consider making them real generic parameter constraints in some later version of Swift, along with other loose constraints such as move-only objects, or objects with explicit value/reference semantics.</div><div class=""><br class=""></div><div class="">If anybody’s interested, see:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift/blob/ec6fc4d54db95f78ae72dab29734533f709ea2d7/include/swift/AST/KnownIdentifiers.def#L106" class="">https://github.com/apple/swift/blob/ec6fc4d54db95f78ae72dab29734533f709ea2d7/include/swift/AST/KnownIdentifiers.def#L106</a>&nbsp;for the list of currently-supported layout constraints, and</div><div class=""><a href="https://github.com/apple/swift/blob/ff6747de77597afa055bb239b3d3b215640d30ea/test/attr/attr_specialize.swift#L212" class="">https://github.com/apple/swift/blob/ff6747de77597afa055bb239b3d3b215640d30ea/test/attr/attr_specialize.swift#L212</a>&nbsp;for examples</div><div class=""><br class=""></div><div class="">- Karl</div><div class=""><br class=""></div></body></html>