[swift-evolution] Generic Alaises
Milos Rankovic
milos at milos-and-slavica.net
Wed Apr 6 15:05:29 CDT 2016
Chris Lattner has a proposal under review <https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md> on this topic.
milos
> On 6 Apr 2016, at 20:41, James Campbell via swift-evolution <swift-evolution at swift.org> wrote:
>
> This was inspired from the topic about moving where clauses out of parameter lists.
>
> Certain generics get very long winded, I was wondering if we could create some sort of alias for generics.
>
> func anyCommonElements <T: SequenceType, U: SequenceType where T.Generator.Element: Equatable, T.Generator.Element == U.Generator.Element> (lhs: T, _ rhs: U) -> Bool
>
> could be shared across functions like so:
>
> genericalias SequencesWithSameElements<T, U> = <T: SequenceType, U: SequenceType where T.Generator.Element: Equatable, T.Generator.Element == U.Generator.Element>
>
> func anyCommonElements <SequencesWithSameElements> (lhs: T, _ rhs: U) -> Bool
> func == <SequencesWithSameElements> (lhs: T, _ rhs: U) -> Bool
> ___________________________________
>
> James⎥
>
> james at supmenow.com <mailto:james at supmenow.com>⎥supmenow.com <http://supmenow.com/>
> Sup
>
> Runway East
>
>
> 10 Finsbury Square
>
> London
>
>
> EC2A 1AF
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160406/6eac54c8/attachment.html>
More information about the swift-evolution
mailing list