> On Mar 16, 2016, at 18:10 , Brent Royal-Gordon via swift-evolution 
> <[email protected]> wrote:
> 
>>      • What is your evaluation of the proposal?
> 
> Good stuff.
> 
> How exact does the type match have to be? Can they be two subclasses of a 
> different superclass? Can they conform to common protocols? Can they conform 
> to no common protocols and just be `AnyObject` or `Any`?
> 
> Is there a way to specify the type, either to get an exact match or just to 
> ask or a supertype? If you do that, does it have to be specified on both, or 
> only one? Something like:
> 
>       case let .Case1(x: SignedIntegerType, 2), let .Case2(2, x): 

In GregT's current implementation, the types have to be an exact match. You can 
use the existing "as Foo" constraint to specify a type, but it must be 
specified everywhere that that wouldn't be the inferred type. (See my earlier 
message to Andrii C: 
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160314/012779.html)
 Note that that also isn't "as!"; if used with a subtype instead of a 
supertype, it imposes (and has always imposed) an additional constraint on the 
match.

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

Reply via email to