<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Marc,<div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class="">The second class defines a static property that looks like it is 'overriding' the static property from<br class="">the protocol extension, but since the types don't match (String vs. String?), it sort of 'overloads'<br class="">the property (similar to function overloading). Nevertheless, the class still fulfills the requirements<br class="">of the Trackable protocol, by inheriting the static property from the protocol extension.<br class=""></blockquote><br class="">Isn’t this a compiler bug?<br class=""><br class="">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. <br class=""><br class="">This behaviour seems to create major hard-to-detect hazards when using protocol extensions, which seems against the spirit of Swift. <br class=""></div></div></blockquote><br class=""></div><div>Yeah, I guess overloading might not be the right term. You're right, properties can't be overloaded in general. For example:</div><div><br class=""></div><div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">struct S {</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">&nbsp; &nbsp; static var x: Int { return 2 }</font></div></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">&nbsp; &nbsp; static var x = ""<span class="Apple-tab-span" style="white-space:pre">                        </span>// error: invalid redeclaration of 'x'</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">You can only 'overload' properties that are inherited from a protocol extension.&nbsp;</div></div><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">protocol P {}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">extension P {</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">&nbsp; &nbsp; static var x: Int { return 2 }</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">}</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">struct S: P {</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">&nbsp; &nbsp; static var x = ""</font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class="">}</font></div></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><font face="Courier New" class=""><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">I am not exactly sure why this is allowed, but maybe someone from the Swift team can help.</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Best regards,</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">Toni</div></body></html>