Re: [swift-evolution] [Pitch] BitPatternRepresentable

2017-07-16 Thread Karl Wagner via swift-evolution
> On 16. Jul 2017, at 16:26, Dave Abrahams via swift-evolution > wrote: > > > on Sun Jul 16 2017, Jens Persson wrote: > >> On Wed, Jul 12, 2017 at 12:23 AM, Dave Abrahams via swift-evolution < >> swift-evolution@swift.org> wrote: >> >>>

Re: [swift-evolution] [Pitch] BitPatternRepresentable

2017-07-16 Thread Dave Abrahams via swift-evolution
on Sun Jul 16 2017, Jens Persson wrote: > On Wed, Jul 12, 2017 at 12:23 AM, Dave Abrahams via swift-evolution < > swift-evolution@swift.org> wrote: > >> /../ >> As ever, my first question when a new protocol is proposed is, “what >> generic algorithms rely on this

Re: [swift-evolution] [Pitch] BitPatternRepresentable

2017-07-16 Thread Jens Persson via swift-evolution
On Wed, Jul 12, 2017 at 12:23 AM, Dave Abrahams via swift-evolution < swift-evolution@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

Re: [swift-evolution] [Pitch] BitPatternRepresentable

2017-07-11 Thread Dave Abrahams via swift-evolution
on Tue Jul 11 2017, Jens Persson 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

[swift-evolution] [Pitch] BitPatternRepresentable

2017-07-11 Thread Jens Persson via swift-evolution
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

Re: [swift-evolution] [Pitch] BitPatternRepresentable

2017-07-11 Thread Jens Persson via swift-evolution
Oh, I forgot the signed IntN types: extension Int8 : BitPatternRepresentable { var bitPattern: UInt8 { return UInt8(bitPattern: self) } init(bitPattern: UInt8) { self = Int8(bitPattern: bitPattern) } } extension Int16 : BitPatternRepresentable { var bitPattern: UInt16 { return