[swift-evolution] [Pitch] Rename protocol<> to Any<>

Adrian Zubarev adrian.zubarev at devandartist.com
Thu May 19 02:57:32 CDT 2016


I assume you meant to use Any and not protocol above.
No, I was wondering why Any<Any, A>> would create a warning whereas protocol<Any, A> does not today.

They can all be interpreted, but:
- they provide multiple ways of expressing the same concept
- the additional uses of Any detract from code clarity
- it is possible (in the absence of an established design) that these syntaxes (particularly Any<Any<ProtocolA>>) might limit our ability to add existential types without either breaking existing code or adding special cases in the parser. I can go into more detail on my reasoning here, but that seems a diversion of this topic to do so.

An example elsewhere in the language of otherwise valid code being rejected because the syntax is redundant:

enum MyError:ErrorType, ErrorType {}

I’m also specifically saying that the *syntax* should warn on the use of Any-within-Any. Code such as:

typealias Foo = Any
typealias Bar = Any<Foo, Sequence>

would be fine.

-DW

And there I have my explanation to this. :)

-- 
Adrian Zubarev
Sent with Airmail


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160519/22da64e8/attachment.html>


More information about the swift-evolution mailing list