[swift-evolution] [proposal] Generic type aliases

Brent Royal-Gordon brent at architechies.com
Wed Mar 16 19:09:27 CDT 2016


>> However, we do infer the `T: Hashable` in a case like this:
>> 
>> func foo<T>(x: Dictionary<T, String>) {}
>> 
>> `typealias` feels similar to that to me. It doesn't have to be a global analysis, just an analysis of the RHS of the typealias.
> 
> I consider the RHS of the typealias to be the “body” of the type alias, and parameters to be part of the “signature” of the funcdecl.

The RHS of a stored variable declaration is essentially its body, but we infer types across that boundary. (Granted, not generic constraints since variables can't be generic yet.)

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list