on Wed Jun 15 2016, Brent Royal-Gordon <[email protected]> wrote:

> While I was watching WWDC videos today, I noticed that there's a bit
> of annoying boilerplate in OptionSet specifications, and set out to
> get rid of it. Basically, what I'd like to do is this:
>
>       extension OptionSet where RawValue: Integer {
>           init(bit bits: RawValue...) {
>               self.init(rawValue: bits.reduce(0) { $0 | (1 << $1) })
>           }
>       }
>
>       struct FooOptions: OptionSet {
>           let rawValue: Int
>
>           static let bar = FooOptions(bit: 0)
>           static let baz = FooOptions(bit: 1)
>       }
>
> However, this was thwarted by the fact that the << operator is not in
> Integer. Or BitwiseOperations. Or any protocol, in fact.
>
> From what I understand, this is a long-known issue we were planning to
> address in the Integer redesign, but I'm not sure what the status of
> that is at this point. 

A proposal is imminent.
-- 
-Dave

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to