[SE-0011] Re-considering the replacement keyword for "typealias"


(Kyle Carson) #1

All of the options I've seen suffer from a common problem: The order of parameters isn't obvious. If we use an additional keyword we can have a more readable syntax.

Example using "associate" and "with":

associate *NewType* with *ExistingType*

Positives:
- Extremely clear, readable
- Relatively short syntax

Possible Negatives:
- May not be easy to Google
- Do multiple keywords fits Swift's general style?


(Brent Royal-Gordon) #2

All of the options I've seen suffer from a common problem: The order of parameters isn't obvious. If we use an additional keyword we can have a more readable syntax.

Example using "associate" and "with":

associate *NewType* with *ExistingType*

I don't understand what you're suggesting here. What is `ExistingType`? Does this go inside the `protocol` block or outside?

For illustration, perhaps you can translate this into your syntax:

  public protocol GeneratorType {
      typealias Element
      public mutating func next() -> Self.Element?
  }

···

--
Brent Royal-Gordon
Architechies