[swift-evolution] [Pitch] BitPatternRepresentable

Dave Abrahams dabrahams at apple.com
Sun Jul 16 09:16:12 CDT 2017

on Sun Jul 16 2017, Jens Persson <swift-evolution at swift.org> wrote:

> On Wed, Jul 12, 2017 at 12:23 AM, Dave Abrahams via swift-evolution <
> swift-evolution at swift.org> wrote:
>> /../
>> As ever, my first question when a new protocol is proposed is, “what
>> generic algorithms rely on this protocol?”
> First, please note that I made some mistakes in the code earlier in this
> conversation as I did not have a compiler at hand, a better version can be
> found in the PS-section of this post:
> https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20170710/005921.html

Looking closer at your proposal, it appears to be representing in the
language the notion of a trivial type:


That's definitely something we should do in order to support low-level

> It contains some more context also.
> To answer your question: I'm using it as one of the basic building blocks
> needed for implementing generic statically allocated Vector types with
> type-level Element and Count/Index (despite the current limitations of
> Swift's type system!) , 

Yes, Michael Ilseman and I have solved the same problem in several ways
ourselves.  Of course the particular problem of fixed-sized arrays
should probably have native support, but a builtin way to identify
trivial types at compile-time would be helpful as well.


More information about the swift-evolution mailing list