2017-01-12 0:51 GMT+03:00 David Sweeris <[email protected]>:
>
> I don't understand the lines in the struct version where you assign
> something to `self`. What is ".invalid", for example? I thought you'd
> removed the enum altogether.
>
I totally overlooked it. That can't be done with protocols, scrap that
suggestion.
> But pattern matching on structs is impossible—we can change that with a
> separate proposal. For example, we can allow destructuring
> structs/enums/classes by any combination of their properties:
>
> struct S {
> var foo: Int
> var bar: Double
> var buz: String { return "42" }
> }
> let s = S(foo: 42, bar: 42.0)
> let S(foo: x, buz: z) = s
>
> I was under the impression that we could switch over anything that had the
> `~=` operator defined. Is that not the case?
>
Well, this one is a bit different, but it's horribly off-topic for this
thread.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution