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
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution