> On 1 Jan 2018, at 20:40, Toni Suter <tonisu...@me.com> wrote:
> 
> Hi Marc,
> 
> There are several subtleties here, but I think the compiler is actually doing 
> the right thing.
> 

Hi Toni,

Thanks for your detailed response. 

[..]
> The second class defines a static property that looks like it is 'overriding' 
> the static property from
> the protocol extension, but since the types don't match (String vs. String?), 
> it sort of 'overloads'
> the property (similar to function overloading). Nevertheless, the class still 
> fulfills the requirements
> of the Trackable protocol, by inheriting the static property from the 
> protocol extension.

Isn’t this a compiler bug?

I didn’t realise that overloading properties was a thing? I’m pretty sure it 
isn’t, in which case the compiler should choke because there are two properties 
of the same name but divergent types available on the type. 

This behaviour seems to create major hard-to-detect hazards when using protocol 
extensions, which seems against the spirit of Swift. 

Marc
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to