> On Mar 9, 2016, at 8:47 PM, Chris Lattner via swift-evolution
> <swift-evolution@swift.org> wrote:
>
> This is a minimal proposal for introducing type aliases into Swift, and
> intentionally chooses to keep them limited to being “aliases”. As such,
> additional constraints are not allowed in this base proposal, e.g. you can’t
> write:
>
> typealias StringDictionary<T where T : Hashable> = Dictionary<String, T>
>
> Otherwise, generic type aliases follow the model of type aliases and the
> precedent of the other generic declarations in Swift. For example, they
> allow the usual access control features that type aliases support.
> Similarly, like non-generic type aliases, generic type aliases cannot be
> “resilient”.
Can we at least infer existing constraints from the aliased type? For example,
in something like:
typealias FakeSet<T> = Dictionary<T, ()>
you'd need to propagate the `T: Hashable` constraint from `Dictionary`'s first
parameter to the typealias for it to be sound.
-Joe
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution