<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-size: 16px;" class="">While discussing leading enumeration dot prefixes, Howard Lovatt asked why static properties and methods could not be inferred via a dot prefix as well. Based on Swift-Evolution conventions, here's a new thread to discuss this idea: specifically, would it be beneficial (and/or possible) to use dot prefixes to denote static member references in instance member code.</div><div style="font-size: 16px;" class=""><br class=""></div><div style="font-size: 16px;" class="">Howard wrote:</div><div style="font-size: 16px;" class=""><br class=""></div><div style="font-size: 16px;" class=""></div><blockquote type="cite" style="font-size: 16px;" class=""><div class=""><span style="font-family: Palatino-Roman;" class="">+1 for the proposal, it is wierd to use `.` in some places and not others.&nbsp;</span><div style="font-family: Palatino-Roman;" class=""><br class=""></div><div style="font-family: Palatino-Roman;" class="">On the subject of static methods and properties in general, would it be possible for `.name` to be a reference to a static and `name` a reference to an instance? EG:</div><div style="font-family: Palatino-Roman;" class=""><br class=""></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; .name = x // static</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; name = x // instance</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; x = name + .name // instance + static</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; r = name ... .name // instance ... static, needs space</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; r = name...Type.name // Can still qualify with type name</font></div></div><div style="font-family: Palatino-Roman;" class=""><br class=""></div></blockquote><div style="font-size: 16px;" class=""><br class=""></div><span style="font-size: 16px;" class="">Under the current system, you must explicitly name or derive a type to access static members from instance member implementations.</span><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span> MyStruct {</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">static</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> staticMember() {}</div><p style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; min-height: 21px;" class="">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> instanceMember() {</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class=""><span style="color: rgb(0, 132, 0);" class="">&nbsp; &nbsp; &nbsp; &nbsp; // name a type</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(79, 129, 135);" class="">MyStruct</span>.<span style="color: rgb(49, 89, 93);" class="">staticMember</span>()&nbsp;<span style="color: rgb(0, 132, 0);" class="">// works</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class=""><span style="color: rgb(0, 132, 0);" class=""><br class=""></span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class=""><span style="color: rgb(0, 132, 0);" class="">&nbsp; &nbsp; &nbsp; &nbsp; // derive a type</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>self<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span>dynamicType<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">staticMember</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">() </span><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// works</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(49, 89, 93);" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>// error: value of tuple type '()' has no member 'staticMember'</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span>// does not work</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; .staticMember()</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">}</div><div class=""><br class=""></div><div style="font-size: 16px;" class="">Using dot prefixes for static member access:</div></div><div style="font-size: 16px;" class=""><br class=""></div><div style="font-size: 16px;" class="">* Has precedent in enumeration members</div><div style="font-size: 16px;" class="">* Would streamline Swift code</div><div style="font-size: 16px;" class="">* Is visually differentiated from `self`-prefixed instance member references</div><div style="font-size: 16px;" class=""><br class=""></div><div style="font-size: 16px;" class="">What are your thoughts, both technical and philosophical, on a change like this? Thanks in advance for your feedback.</div><div style="font-size: 16px;" class=""><br class=""></div><div style="font-size: 16px;" class="">-- Erica</div><div class=""><br class=""></div></body></html>