> The same would work for generic types  too:
> 
> public struct Dictionary<Key, Value>
>     where Key : Hashable
> {
>    ...
> }

And I'm not sure if people feel the same as me, but I haven't been happy with 
the current way generic arguments (such as Key and Value above) magically 
appear in type extensions but are inaccessible from anywhere else and can't be 
made public (`public typealias Key = Key` is an error).

The above syntax would make it possible to use whatever identifiers locally so 
that it's clear what they are:

extension Dictionary<K, V>
    // (unclear if `where K : Hashable` should be repeated here, though)
{
    ...
}

extension Array<T>
    where T : Comparable
{
    ...
}

extension Array<T>
    where T == String
{
    ...
}

etc.

— Pyry
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to