[Review] SE-0048: Generic Type Aliases

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

Reply text

Other replies
<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

Thank you,

Doug Gregor

Review Manager

What is your evaluation of the proposal?
+1, originally I hadn’t seen the value, but ran into wanting this just the other day.

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

Does this proposal fit well with the feel and direction of Swift?
Very much so.

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

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Pretty brief, read through the proposal early on and was reaching for this functionality a few days ago.

···

On Mar 24, 2016, at 9:54 AM, Douglas Gregor <dgregor@apple.com> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

Doug Gregor

Review Manager

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

That's my biggest question about this proposal. Yes, as the proposal
says, generic type aliases fill an obvious functional gap. But what
real-world problems are they solving and why should adding them be a
priority?

···

on Thu Mar 24 2016, Douglas Gregor <dgregor-AT-apple.com> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the
review manager. When replying, please try to keep the proposal link at
the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. goes into a review?

The goal of the review process is to improve the proposal under review
through constructive criticism and, eventually, determine the
direction of Swift. When writing your review, here are some questions
you might want to answer in your review:

What is your evaluation of the proposal?

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

--
Dave

What is your evaluation of the proposal?
+1. Especially for forcing the alias side of the declaration to explicitly keep track of type constraints.

Is the problem being addressed significant enough to warrant a change to Swift?
Yes. Previously, one could "work around" this by declaring a 0-case generic enum with associated type "projections". I'm glad to see that pattern find a formal place in the language.

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

If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
This proposal brings Swift up to par with languages that allow any kind of "alias"ing of types, whether that be C++ or Haskell [in a cleaner way than the former].

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
In-depth study. I actually took a crack at an implementation a while ago!

~Robert Widmann

2016/03/24 12:54、Douglas Gregor via swift-evolution <swift-evolution@swift.org> のメッセージ:

···

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

Doug Gregor

Review Manager

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

What is your evaluation of the proposal?
A strong +1 on this.

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

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

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

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
In-depth study, I ran into a situation where I needed something like this some time ago.

···

On Mar 24, 2016, at 1:54 PM, Douglas Gregor <dgregor@apple.com> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

Doug Gregor

Review Manager

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

What is your evaluation of the proposal?

Big +1. I would prefer to see it go further to allow arbitrary constraints, but it is a big step forward and that can come in the future.

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

Yes

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

Yes

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

Yes, it is very similar.

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

This is a feature I have wanted since the beginning. I followed the discussion and read the proposal.

···

More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

Doug Gregor

Review Manager

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

Strong +1 here too.

R+

···

Sent from my iPhone

On 24 Mar 2016, at 17:54, Douglas Gregor <dgregor@apple.com> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

Doug Gregor

Review Manager

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

+1 for reasons already mentioned by others.

···

On Thu, Mar 24, 2016 at 5:54 PM, Douglas Gregor via swift-evolution < swift-evolution@swift.org> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through
March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md

Reviews are an important part of the Swift evolution process. All reviews
should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution

or, if you would like to keep your feedback private, directly to the
review manager. When replying, please try to keep the proposal link at the
top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md

Reply text

Other replies

<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.
goes into a review?

The goal of the review process is to improve the proposal under review
through constructive criticism and, eventually, determine the direction of
Swift. When writing your review, here are some questions you might want to
answer in your review:

   - What is your evaluation of the proposal?
   - Is the problem being addressed significant enough to warrant a
   change to Swift?
   - Does this proposal fit well with the feel and direction of Swift?
   - If you have used other languages or libraries with a similar
   feature, how do you feel that this proposal compares to those?
   - How much effort did you put into your review? A glance, a quick
   reading, or an in-depth study?

More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md

Thank you,

Doug Gregor

Review Manager

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

--
bitCycle AB | Smedjegatan 12 | 742 32 Östhammar | Sweden

Phone: +46-73-753 24 62
E-mail: jens@bitcycle.com

   - What is your evaluation of the proposal?

Really useful addition

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

Yes, it is a limitation of the current language that you can't do this.
You can get round the limitation using a struct but type alias is a neater
solution.

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

Yes, you would naturally expect this to be possible

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

No

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

Followed swift-evolution discussions

···

--
-- Howard.

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md

  • What is your evaluation of the proposal?

I think it's a good idea that will make a lot of code clearer.

I agree with the decision not to support additional constraints on the generic type. Typealiases should be just what it says in the name: aliases. It should not be possible to constrain a type with a typealias in a way you could not by substituting the same type name in directly.

In other words, I don't think this:

  typealias ComparableArray<T where T : Comparable> = Array<T>

Makes any more sense than this:

  Array<T where T: Comparable>

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

Yes. The "proposed solution" examples are all quite sensible.

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

Yes.

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

I haven't used any such languages enough to ever use an equivalent feature.

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

Quick reading.

···

--
Brent Royal-Gordon
Architechies

What is your evaluation of the proposal?

+1

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

Yes.

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

Yes.

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

I have not used a language with a similar feature.

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

Read thoroughly.

What is your evaluation of the proposal?

Strong +1 here. I've wanted this since day one. In fact, I filed ticket
SR-64 to cover adding this a while ago.

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

Yes, the lack of generic typealiases can be a real annoyance.

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

Yes.

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

Both Haskell and Rust have generic typealiases and it works pretty well.

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

A quick reading, plus I was involved in the original swift-
evolution thread.

-Kevin Ballard

···

On Thu, Mar 24, 2016, at 09:54 AM, Douglas Gregor wrote:

Strong +1 from me, too. With the exact response as Juan. It is among the top 10 on my wish list.

···

On Mar 24, 2016, at 11:18 AM, Juan Ignacio Laube via swift-evolution <swift-evolution@swift.org> wrote:

What is your evaluation of the proposal?
A strong +1 on this.

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

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

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

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
In-depth study, I ran into a situation where I needed something like this some time ago.

On Mar 24, 2016, at 1:54 PM, Douglas Gregor <dgregor@apple.com <mailto:dgregor@apple.com>> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

Doug Gregor

Review Manager

_______________________________________________
swift-evolution-announce mailing list
swift-evolution-announce@swift.org <mailto:swift-evolution-announce@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution-announce

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

(and, sorry for the delay in getting this out; a mail configuration
mistake left it in my queue for much longer than I'd like to admit).

···

on Thu Mar 24 2016, Dave Abrahams <swift-evolution@swift.org> wrote:

on Thu Mar 24 2016, Douglas Gregor <dgregor-AT-apple.com> wrote:

Hello Swift community,

The review of SE-0048 "Generic Type Aliases" begins now and runs
through March 29, 2016. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reviews are an important part of the Swift evolution process. All
reviews should be sent to the swift-evolution mailing list at

https://lists.swift.org/mailman/listinfo/swift-evolution
<https://lists.swift.org/mailman/listinfo/swift-evolution&gt;
or, if you would like to keep your feedback private, directly to the
review manager. When replying, please try to keep the proposal link at
the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
Reply text

Other replies
<GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. goes into a review?

The goal of the review process is to improve the proposal under review
through constructive criticism and, eventually, determine the
direction of Swift. When writing your review, here are some questions
you might want to answer in your review:

What is your evaluation of the proposal?

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

That's my biggest question about this proposal. Yes, as the proposal
says, generic type aliases fill an obvious functional gap. But what
real-world problems are they solving and why should adding them be a
priority?

--
Dave

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

That's my biggest question about this proposal. Yes, as the proposal
says, generic type aliases fill an obvious functional gap. But what
real-world problems are they solving

They allow you to make aliases for generic types, e.g. from the document:

  typealias StringDictionary<T> = Dictionary<String, T>
  typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
  typealias IntFunction<T> = (T) -> Int
  typealias Vec3<T> = (T, T, T)
  typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)

It is an inconsistency in the language that you can create aliases for non-generic types, but that you can’t make them for generic ones. Perhaps you are objecting to typealias as a feature at all?

and why should adding them be a priority?

It is part of the general goal of completing the generics system, a stated Swift 3 goal.

-Chris

···

On Mar 24, 2016, at 1:18 PM, Dave Abrahams via swift-evolution <swift-evolution@swift.org> wrote:

https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md

   • What is your evaluation of the proposal?

+1

I think it is a very important feature to enable working with more complicated generic types while maintaining readability.

I do not agree with the decision not to support additional constraints on the generic type. I do have the strong feeling that this would be useful. At the moment it is not more than a feeling, though, without a compelling example, and as it can easily be added later I'm fine with a first implementation as proposed.

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

Yes, definitely.

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

Yes.

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

Haskell has generic typealiases which are quite commonly used.

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

A quick reading.

-Thorsten

Personally I find typealias useful for giving a friendly name to long types
and informative names to types in general. This applies to generic types as
much as non-generic, e.g.:

    typealias Vec4<T: Numerical> = (T, T, T, T)
    typealias Mat4<T: Numerical> = (Vec<T>, Vec<T>, Vec<T>, Vec<T>)

Further I would like to be able to add additional constraints that are not
part of the rhs of the alias, e.g.:

    typealias VecSparse<T: Numerical> = Dictionary<Int, T>
    typealias MatSparse<T: Numerical> = Dictionary<Int, VecSparse<T>>

···

On Friday, 25 March 2016, Dave Abrahams via swift-evolution < swift-evolution@swift.org> wrote:

on Thu Mar 24 2016, Douglas Gregor <dgregor-AT-apple.com> wrote:

> Hello Swift community,
>
> The review of SE-0048 "Generic Type Aliases" begins now and runs through
March 29, 2016. The proposal is available here:
>
>
https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
> Reviews are an important part of the Swift evolution process. All
reviews should be sent to the swift-evolution mailing list at
>
> https://lists.swift.org/mailman/listinfo/swift-evolution <
https://lists.swift.org/mailman/listinfo/swift-evolution&gt;
> or, if you would like to keep your feedback private, directly to the
> review manager. When replying, please try to keep the proposal link at
> the top of the message:
>
> Proposal link:
>
>
https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md
> Reply text
>
> Other replies
> <GitHub - apple/swift-evolution: This maintains proposals for changes and user-visible enhancements to the Swift Programming Language.
goes into a review?
>
> The goal of the review process is to improve the proposal under review
> through constructive criticism and, eventually, determine the
> direction of Swift. When writing your review, here are some questions
> you might want to answer in your review:
>
> What is your evaluation of the proposal?
>
> Is the problem being addressed significant enough to warrant a change
> to Swift?

That's my biggest question about this proposal. Yes, as the proposal
says, generic type aliases fill an obvious functional gap. But what
real-world problems are they solving and why should adding them be a
priority?

--
Dave
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <javascript:;>
https://lists.swift.org/mailman/listinfo/swift-evolution

--
-- Howard.

To give a motivating example, we ported a streaming library that involved a highly generic type called Proxy<A, B, X, Y, R> (here https://github.com/typelift/Aquifer/blob/master/Aquifer/Proxy.swift#L62\) that is built in such a way that its various generic aliases (written below in the enum's typealiases) impart upon it completely different semantics and use cases depending on how the underlying type is specialized. Without generic aliases, we're forced to use the hacks in that linked file and expose methods that suggest a particular semantics by reaching for the right enum and asking for the respective typealias. This way, we can cut out the middle man and just get on with it.

So, even if this feature weren't here there is still a way to do it in the language as it stands. But for something that is so obviously a gap in the implementation, not including it seems a waste, don't you think?

~Robert Widmann

2016/03/29 0:28、Chris Lattner via swift-evolution <swift-evolution@swift.org> のメッセージ:

···

On Mar 24, 2016, at 1:18 PM, Dave Abrahams via swift-evolution <swift-evolution@swift.org> wrote:

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

That's my biggest question about this proposal. Yes, as the proposal
says, generic type aliases fill an obvious functional gap. But what
real-world problems are they solving

They allow you to make aliases for generic types, e.g. from the document:

   typealias StringDictionary<T> = Dictionary<String, T>
   typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
   typealias IntFunction<T> = (T) -> Int
   typealias Vec3<T> = (T, T, T)
   typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)

It is an inconsistency in the language that you can create aliases for non-generic types, but that you can’t make them for generic ones. Perhaps you are objecting to typealias as a feature at all?

and why should adding them be a priority?

It is part of the general goal of completing the generics system, a stated Swift 3 goal.

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

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

That's my biggest question about this proposal. Yes, as the proposal
says, generic type aliases fill an obvious functional gap. But what
real-world problems are they solving

They allow you to make aliases for generic types, e.g. from the document:

  typealias StringDictionary<T> = Dictionary<String, T>
  typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
  typealias IntFunction<T> = (T) -> Int
  typealias Vec3<T> = (T, T, T)
  typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)

I know what the feature allows. What I don't see is any burning need
for it.

It is an inconsistency in the language that you can create aliases for
non-generic types, but that you can’t make them for generic ones.
Perhaps you are objecting to typealias as a feature at all?

I'm not objecting at all. It's an obvious thing for us to do, and we
should do it at some point. It just doesn't seem very impactful or
crucial.

and why should adding them be a priority?

It is part of the general goal of completing the generics system, a
stated Swift 3 goal.

True. I just wonder if we should be frying bigger fish.

···

on Mon Mar 28 2016, Chris Lattner <clattner-AT-apple.com> wrote:

On Mar 24, 2016, at 1:18 PM, Dave Abrahams via swift-evolution <swift-evolution@swift.org> wrote:

--
Dave

I use typealiases as a form of documentation for an API, not just for convenience. The fact that Xcode parses the doc comments on them is also quite useful.

Russ

···

On Mar 29, 2016, at 10:14 AM, Dave Abrahams via swift-evolution <swift-evolution@swift.org> wrote:

I'm not objecting at all. It's an obvious thing for us to do, and we
should do it at some point. It just doesn't seem very impactful or
crucial.