[swift-evolution] [Pitch] BitPatternRepresentable

Dave Abrahams dabrahams at apple.com
Tue Jul 11 17:16:17 CDT 2017


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

> I've found it practical/necessary to write my own BitPatternRepresentable
> protocol and IMHO it feels like something that could have been added along
> with the improved numeric protocols of Swift 4.
>
> Would it make sense to add something like the following to the standard
> library?
>
> /// A type that can be converted to and from an associated BitPattern type.
> protocol BitPatternRepresentable {
>     associatedtype BitPattern
>     var bitPattern: BitPattern { get }
>     init(bitPattern: BitPattern)
> }

As ever, my first question when a new protocol is proposed is, “what
generic algorithms rely on this protocol?”

inquiring-minds-wanna-know-ly y'rs,

-- 
-Dave



More information about the swift-evolution mailing list