[swift-evolution] [Review] Replace `typealias` keyword with `associatedtype` for associated type declarations

Paul Cantrell cantrell at pobox.com
Wed Jan 6 13:58:22 CST 2016

What is your evaluation of the proposal?

In favor.

Overloading the meaning of “typealias” adds confusion to what is already a confusing feature of the language. The keyword “associatedtype” is much clearer — and much more searchable, helping newcomers to this feature discover the relevant documentation.

The words “associated type” are easily the best of any alternatives proposed. Others (“associated”, “type”, etc.) are all either too vague or too obtuse, and many are likely to cause identifier collisions. No other terminology mentioned in the discussion comes in even a close second for me.

What about the all lower case “associatedtype”? The underscore alternative of “associated_type” breaks existing language precedent. The camel case version (“associatedType”) does have language precedent, and I wonder if it wouldn’t be a better choice:


However, there’s also precedent for making paired words all lowercase in keywords:

    deinit           ←(debatable: could be considered single word or hyphenated)

Perhaps keyword capitalization conventions deserve some attention across the board.

Regardless, I can happily accept “associatedtype.”

Is the problem being addressed significant enough to warrant a change to Swift?

Certainly. Associated types clearly are a point of confusion, and active evolution. Anything that clarifies their meaning is worth considering.

Does this proposal fit well with the feel and direction of Swift?

Swift’s other keywords tend to favor the transparently descriptive (mutating, didSet) over the jargon-y (const, volatile). This change fits that tendency.

If you have you used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I haven’t, at least not enough to give useful insight..

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

I loosely followed the discussion thread.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160106/cbf157be/attachment.html>

More information about the swift-evolution mailing list