>   // With the new collection model (SE-0065), indices are simply Comparable 
> now
>   // Okay to cast from x.Index to Comparable
>   let a = anIndex as Comparable
> 
>   // Not okay to cast from Comparable to y.Index
>   let b = a as y.Index
> 
>   // This should be okay. We may want to break this feature into 'Opening 
> Existentials' follow-up proposal
>   if let b = a as? y.Index {
>     // do stuff with b
>   }

If you're going to do this, it might make sense to add a new form of 
`as?`/`as!` cast for casting between the same associated type on different 
existentials:

        if let b = x.startIndex as? y.Index {
                // do stuff with b
        }

This would succeed if the concrete types of `x` and `y` had the same type for 
`Index`, and fail otherwise.

-- 
Brent Royal-Gordon
Architechies

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

Reply via email to