[swift-evolution] [SE-0011] Re-considering the replacement keyword for "typealias"
Paul Cantrell
paul at innig.net
Wed Dec 23 10:42:09 CST 2015
> On Dec 23, 2015, at 10:34 AM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>
> Here are how I see the pros and cons I see of these options:
>
> type:
> - Overly short, particularly given the infrequency of these decls, the common case of “type Element” will be weird floating around given its lack of weight.
> - Overly unclear. This is a very specific kind of type, not a generic type you can use in other contexts.
> - Unfortunate keyword. Among other things it would make writing compilers in swift a pain :-), but again, people would want to use this in other places.
>
> associated:
> - Vacuous: doesn’t mean anything on its own: “associated Element”.
> - Somewhat unfortunate as a keyword, but much less so than type.
>
> associatedtype:
> - Clean in context: “associatedtype Element”
> - Obvious you wouldn’t want to use it in another context.
> - Googlable, unambiguous
Add to the “associatedtype” advantages that, unlike the other two, it passes the “unfortunate keyword” test with flying colors. I don’t often want to name a variable “associatedtype”.
Cheers, P
More information about the swift-evolution
mailing list