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

Adrian Zubarev adrian.zubarev at devandartist.com
Tue May 17 05:12:17 CDT 2016


But don't you mean the union type of all possible Collection types when you write Any<Collection>?

I suggested `all<>` for the intersection type, and `any<>` for the union type, so that would be the same, wouldn't it?
Thats exactly how I understand out situation by now. I was confused by Thorsten's `intersection` first, but now I see that he meant the intersection between dynamic type and the whole set of constraints provided by `All<…>`. I thought about about the constraints union compared to the dynamic type, which is most likely the same thing.

In my proposal I reserved the name `Any<>` for future directions, but noted that we still might choose `Any<…>` for the proposed `All<…>` and then name `Any<…>` described by Thorsten as `Either<…>`.


 >> We've been over this a few times before on the list. I personally like naming this thing "Any<…>" in the same vein as "AnyObject", "AnyClass", and "AnySequence". I also see Thorsten (and in the past Brent's?) argument for calling it "all" or "All", because it's enforcing multiple constraints.
> 
> I have suggested `all<>` in the past, but I now favor `Any`, because that allows it to be unified with the universal supertype `Any`, `Any<class>`, and things like `Any<Collection>` to forge the One Existential Syntax to rule them all.
I considered `Any<>` as an alternative and personally I don’t have anything against that little change. I still don’t like `AnyObject` because it uses `Object` instead of `Class`, where `AnyClass` is `AnyObject.Type`. This is way to confusing if you ask me. I’d rename both into `ClassInstance` == `AnyObject` and `ClassType` == `AnyClass`. If Swift one day might introduce `struct` and `enum` keywords that are generalized like `class` (could be) what name would you choose? Compared to `AnyClass` typealias `AnyStruct` would be `AnyXYZ.Type`. The only type I like which uses `Any` as its prefix is `Any` itself. 

But I guess this is something the core team will decide.

If there is no feedback towards the document I wrote anymore, I’ll submit a pull request later this day. (Note: I’ll add some small changes in the alternatives section about dropping the restriction of a single reference/value type within the angle brackets).

-- 
Adrian Zubarev
Sent with Airmail

Am 17. Mai 2016 bei 07:17:21, Thorsten Seitz via swift-evolution (swift-evolution at swift.org) schrieb:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160517/40ba34e4/attachment.html>


More information about the swift-evolution mailing list