[swift-evolution] [Pitch] merge types and protocols back together with type<Type, Protocol, ...>

Adrian Zubarev adrian.zubarev at devandartist.com
Tue May 17 02:33:43 CDT 2016


What do you mean by "go before review"? 

I moved the proposal to a new thread: [Proposal] New mechanism to combine Types with/or Protocols 

Feel free to read the formatted document, provide me some feedback and point me to typos if you spot any. 

I'll add the possibility to allow multiple reference/value types within the angle brackets as a considered alternative. 

I finally understand what Thorsten meant with this example: 

func intersect<T, U>(set1: Set<T>, set2: Set<U>) -> Set<All<T, U>> 

If T == U we'll get All<T, T> == T 

Or simply: 

func intersect<T>(set1: Set<T>, set2: Set<T>) -> Set<All<T>> 

This makes more sense to me. :)

-- 
Adrian Zubarev 

Am 17. Mai 2016 um 09:09:55, Austin Zheng via swift-evolution (swift-evolution at swift.org(mailto:swift-evolution at swift.org)) schrieb:

> 
> This is the proposal I'd like to see go before review, and the one I think is closest in spirit to the generics roadmap.
> 
> Things like adding union types, and rewriting Swift's type system to look like Scala's, have very little to do with better representations of existentials, and belong in a follow-up proposal.
> 
> Austin
> 
> > On May 16, 2016, at 11:55 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> > 
> > > But don't you mean the union type of all possible Collection types when you write Any<Collection>?
> > 
> > No, I mean "an existential capable of holding any Collection".
> > 
> > If I write Any<Equatable, Collection>, I mean "an existential capable of holding any Equatable Collection".
> > 
> > If I write Any<UITableViewCell, CounterDisplaying>, I mean "an existential capable of holding any CounterDisplaying UITableViewCell".
> > 
> > If I write Any<Collection where .Element: Equatable>, I mean "an existential capable of holding any Collection with an Equatable Element".
> > 
> > If I write Any<class>, I mean "An existential capable of holding any class instance".
> > 
> > If I write Any, I mean "An existential capable of holding anything".
> > 
> > Union types have nothing to do with it.
> > 
> > --
> > Brent Royal-Gordon
> > Architechies
> > 
> > _______________________________________________
> > swift-evolution mailing list
> > swift-evolution at swift.org
> > https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> 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/20160517/7e7d1f62/attachment.html>


More information about the swift-evolution mailing list