[Accepted] SE-0361: Extensions on bound generic types

The review of SE-0361: Extensions on bound generic types has come to a close.

Feedback was generally strongly positive, with almost no-one rejecting the basic idea of allowing extensions of fully-concrete applications of generic types. This was not unexpected, since these extensions are already allowed, just using the less obvious where syntax.

The Language Workgroup reviewed the feedback and identified two main issues raised by the community:

  • Some members of the community requested the ability to write a partially-concrete extension, perhaps using a syntax like extension Dictionary<String, _> or extension Dictionary<String, *>. Adding some ability to do this seems clearly desirable as a future direction, but it is far from clear what syntax to prefer, and the Language Workgroup sees no need to hold up the acceptance of SE-0361.
  • Several members of the community are concerned that the proposal permits extensions of "sugared" types, allowing you to write e.g. extension [Int] instead of extension Array<Int>. One reason given (among others) was that there would be an unfortunate inconsistency between generic and non-generic extensions. The Language Workgroup discussed this and decided that it would be even more unfortunate to introduce a new distinction between the sugared and non-sugared spellings of types. Furthermore, if future directions do end up allowing more forms of generic extension, it will likely become possible to write all extensions with the sugared spellings, e.g. extension [*] or extension <T> [T], and that may become the preferred way to write such extensions.

SE-0361 has therefore been accepted without modifications.

Thank you for participating in this review and contributing to Swift.

John McCall
Review Manager