[Pitch] Several improvements points about extension and typealias


(frogcjn) #1

1. Allow extension specific dictionary
e.g.
extension Dictionary where Key == String, Value == String
or
extension Dictionary<String, String>

2. Allow extending Equatable internally
currently any type extend to Equatable should make theme public

3. Allow internal typealias for a public type
this internal typealias will only can be used in that package.

Thanks


(Douglas Gregor) #2

Right, the first extension is now accepted by the Swift compiler, which is *awesome*.

The second one is still ill-formed, because the grammar doesn’t permit it. If we want to go there, it needs a swift-evolution proposal.

  - Doug

···

On Oct 5, 2016, at 8:07 AM, Robert Widmann via swift-evolution <swift-evolution@swift.org> wrote:

~Robert Widmann

2016/10/05 11:00、Cao, Jiannan via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> のメッセージ:

1. Allow extension specific dictionary
e.g.
extension Dictionary where Key == String, Value == String
or
extension Dictionary<String, String>

This was just committed by Slava yesterday.


(Robert Widmann) #3

~Robert Widmann

2016/10/05 11:00、Cao, Jiannan via swift-evolution <swift-evolution@swift.org> のメッセージ:

1. Allow extension specific dictionary
e.g.
extension Dictionary where Key == String, Value == String
or
extension Dictionary<String, String>

This was just committed by Slava yesterday.

2. Allow extending Equatable internally
currently any type extend to Equatable should make theme public

"Hidden Conformances" are discussed in the generics manifesto.

3. Allow internal typealias for a public type
this internal typealias will only can be used in that package.

Interesting idea.

···

Thanks

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