> On May 27, 2016, at 3:45 AM, Austin Zheng via swift-evolution 
> <[email protected]> wrote:
> 
> As far as I understand it (and the core team as well, judging from their 
> posts), an existential is just a type defined by an interface of some sort 
> ("there exists a type that is capable of X, Y, and Z"), and you can put any 
> value of a type that meets that interface in the existential. The associated 
> types/self types requirements are non-essential add-ons.
> 
> I am about to fall asleep, though, so I'd be happy to reread the article 
> tomorrow and if I'm wrong, make the change.

This is my understanding as well.  The way I understand existential is that it 
means “there exists a type such that you can perform a given set of operations 
on it”.  Whether the operations are defined in terms of associated types or not 
is irrelevant under this meaning.

> 
> Austin
> 
>> On May 27, 2016, at 1:42 AM, Thorsten Seitz <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> 
>>> Am 27.05.2016 um 10:30 schrieb Austin Zheng <[email protected] 
>>> <mailto:[email protected]>>:
>>> 
>>> Thank you for all your great feedback!
>>> 
>>> Let me try rephrasing what I said, because it wasn't very clear. Apologies.
>>> 
>>> NSView is not an existential, like you said.
>>> 
>>> Any<...> syntax is, as far as we've seen, always used for existential types.
>>> 
>>> "Any<NSView>" *looks* like an existential because it has the "Any<...>" 
>>> syntax, but if it's a synonym for just "NSView" then it actually isn't an 
>>> existential.
>>> 
>>> So "Any<NSView>" isn't an existential, but it looks like one. This is 
>>> something I think would be confusing to a lot of people, and also 
>>> redundant: there is no reason as far as I know to ever write Any<SomeClass> 
>>> when you could just write SomeClass, so by banning the confusing form we 
>>> don't lose any expressive power.
>> 
>> Ah, ok! So `Any<NSView>` is just the same as `NSView`. That’s my 
>> understanding as well :-)
>> 
>> But this does not apply only to classes: `Any<CustomStringConvertible>` is 
>> just the same as `CustomStringConvertible`, too, because 
>> `CustomStringConvertible` does not have associated types or self type 
>> requirements (it is *not* an existential in Wikipedia’s sense).
>> 
>> Banning `Any<Foo>` where `Foo` does not have associated types or self type 
>> requirements would be the right thing to do, I think, regardless whether 
>> `Foo` is a class or a protocol. This would make it clear that `Any<Foo>` is 
>> a *real* existential. 
>> 
>> -Thorsten
>> 
>> 
>>> 
>>> Hope that helps,
>>> Austin
>>> 
>>>> On May 27, 2016, at 1:24 AM, Thorsten Seitz <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>>> 
>>>>> Am 26.05.2016 um 22:44 schrieb Austin Zheng via swift-evolution 
>>>>> <[email protected] <mailto:[email protected]>>:
>>>>> 
>>>>> (inline)
>>>>> 
>>>>> On Thu, May 26, 2016 at 12:22 PM, David Hart <[email protected] 
>>>>> <mailto:[email protected]>> wrote:
>>>>> Hi Austin,
>>>>> 
>>>>> I never had te occasion to say thanks for the work you have put in this 
>>>>> proposal, so thanks! I’m really looking forward to be able to have some 
>>>>> form of it accepted and implemented in Swift.
>>>>> 
>>>>> Thank you! I just hope a proposal like this one ends up being good enough 
>>>>> that it means less work for the core team, not more...
>>>>>  
>>>>> 
>>>>> Here are a few comments:
>>>>> 
>>>>> 1) Why would Any<> and Any<NSView> be illegal? What error messages would 
>>>>> they generate? Why not make them simply synonymous to Any, and NSView, 
>>>>> the same way protocol<> currently behaves?
>>>>> 
>>>>> "Any<>" being illegal is a syntactic battle that is being fought over in 
>>>>> a different thread; I'm not personally invested one way or another. (We 
>>>>> might not even adopt "Any" syntax specifically; Joe Groff has ideas for a 
>>>>> different syntax that doesn't use the brackets.)
>>>>> 
>>>>> "Any<NSView>" is an existential, and "NSView" isn't. Existentials' 
>>>>> metatypes are different from the metatypes of concrete types, and the 
>>>>> ways they can be used with generics is different as well. My opinion is 
>>>>> that Any<...> signifies an existential, and allowing the use of 
>>>>> "Any<SomeClass>" as a concrete type would just confuse people even more.
>>>> 
>>>> 
>>>> This is something where I still have a problem understanding what an 
>>>> existential is in the Swift sense. In the "normal“ sense (as defined in 
>>>> Wikipedia or Haskell) NSView cannot be an existential because it has no 
>>>> unbound associated types. It cannot be just made an existential either. 
>>>> How would that work?
>>>> 
>>>> So, what is the meaning of `Any<NSView>` being an existential? How is that 
>>>> type different from the type `NSView`?
>>>> 
>>>> -Thorsten
>>> 
>> 
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to