Re: [swift-evolution] Generic Alaises

2016-04-06 Thread Milos Rankovic via swift-evolution
Hi Ross, That was a hell of an example! However, even with the types as they are now, the code needn’t look so dreadful. With following protocols in place: protocol Indexed { associatedtype Index : Hashable var index: Index { get } } protocol NodeType : Indexed { } protocol

Re: [swift-evolution] Generic Alaises

2016-04-06 Thread James Campbell via swift-evolution
Ross put it better than I ever could :) yes this is what I meant  Sent from Supmenow.com On Wed, Apr 6, 2016 at 1:45 PM -0700, "Ross O'Brien" wrote: It's not the same topic. Let's take an example: suppose we have a data structure for a graph of nodes

Re: [swift-evolution] Generic Alaises

2016-04-06 Thread Ross O'Brien via swift-evolution
It's not the same topic. Let's take an example: suppose we have a data structure for a graph of nodes and edges, where the nodes and edges are indexed and both have values. So we have a Graph. Now suppose we want a shortest path from one node to another, and we have a data structure to represent

Re: [swift-evolution] Generic Alaises

2016-04-06 Thread Milos Rankovic via swift-evolution
Chris Lattner has a proposal under review on this topic. milos > On 6 Apr 2016, at 20:41, James Campbell via swift-evolution > wrote: > > This was inspired from the topic

[swift-evolution] Generic Alaises

2016-04-06 Thread James Campbell via swift-evolution
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 (lhs: T, _ rhs: U) -> Bool could be shared across functions like so: