<div dir="ltr">This feature removes the need, in specific cases, for wrapping a function in a struct 'just for' the ability to use generics.<div><br></div><div>```swift</div><div>typealias Parser<Output> = String -> Output<br></div><div><br></div><div>// can now, sometimes, replace</div><div><br></div><div>struct Parser<Output> {</div><div> let transform: String -> Output</div><div> init(transform: String -> Output) {</div><div> self.transform = transform</div><div> }</div><div>```</div><div><br></div><div>Both are useful but being forced to use the second declaration when the first would suffice is frustrating.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 29, 2016 at 7:14 PM, Dave Abrahams via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
on Mon Mar 28 2016, Chris Lattner <clattner-AT-apple.com> wrote:<br>
<br>
> On Mar 24, 2016, at 1:18 PM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
>>><br>
>>> Is the problem being addressed significant enough to warrant a change<br>
>>> to Swift?<br>
>><br>
>> That's my biggest question about this proposal. Yes, as the proposal<br>
>> says, generic type aliases fill an obvious functional gap. But what<br>
>> real-world problems are they solving<br>
><br>
> They allow you to make aliases for generic types, e.g. from the document:<br>
><br>
> typealias StringDictionary<T> = Dictionary<String, T><br>
> typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String><br>
> typealias IntFunction<T> = (T) -> Int<br>
> typealias Vec3<T> = (T, T, T)<br>
> typealias BackwardTriple<T1,T2,T3> = (T3, T2, T1)<br>
<br>
</span>I know what the feature allows. What I don't see is any burning need<br>
for it.<br>
<span class=""><br>
> It is an inconsistency in the language that you can create aliases for<br>
> non-generic types, but that you can’t make them for generic ones.<br>
> Perhaps you are objecting to typealias as a feature at all?<br>
<br>
</span>I'm not objecting at all. It's an obvious thing for us to do, and we<br>
should do it at some point. It just doesn't seem very impactful or<br>
crucial.<br>
<span class=""><br>
>> and why should adding them be a priority?<br>
><br>
> It is part of the general goal of completing the generics system, a<br>
> stated Swift 3 goal.<br>
<br>
</span>True. I just wonder if we should be frying bigger fish.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Dave<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>