[swift-evolution] 'T != Type' in where clause

Joe Groff jgroff at apple.com
Tue Feb 28 11:01:11 CST 2017


> On Feb 27, 2017, at 10:21 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> 
> 
> Sent from my iPhone
>> On Feb 27, 2017, at 16:34, Rex Fenley via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I often find myself running into situations where I'll receive "Ambiguous use of..." for overloaded functions or operators. In every case these situations would be easily solved if I could specify "Generic != CertainType" in the where clause of one of the overloads so I can disambiguate the cases. Could this be added to language?
> 
> + all the 1s, along with something like "where !(T: Foo)"

This is an impossible constraint to enforce, since anyone can extend any type to conform to Foo.

-Joe



More information about the swift-evolution mailing list