<div dir="ltr">On Wed, Dec 16, 2015 at 2:18 PM, Matthew Johnson <span dir="ltr">&lt;<a href="mailto:matthew@anandabits.com" target="_blank">matthew@anandabits.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I believe the dot abbreviation only works for enum cases right now.</div></div></blockquote><div><br></div><div>Nope :)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I suppose those can be viewed as static members in some sense but they really something different than that.  If I am mistaken I would like to be corrected.</div></div></blockquote><div><br></div><div>I&#39;ll do my best!</div><div><br></div><div>It works as I was trying to describe earlier. Any static member that returns Self. Try the following in a playground/REPL:<br></div><div><br></div><div><div>    struct Foo {</div><div>        static var bar: Foo {</div><div>            return Foo()</div><div>        }</div><div>        static func baz() -&gt; Foo {</div><div>            return Foo()</div><div>        }</div><div>    }</div><div>    let bar: Foo = .bar</div><div>    let baz: Foo = .baz()</div></div><div><br></div><div>Here&#39;s a SwiftStub demonstrating the behavior: <a href="http://swiftstub.com/579553153">http://swiftstub.com/579553153</a></div><div><br></div><div>Enum cases work with dot abbreviation _because_ they are static members that return Self. Enumerations aren&#39;t special-cased for dot abbreviation.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>The shadowing is *current* behavior in the language.  It is not something I propose.</div></div></div></blockquote><div><br></div><div>Is this true? Can you provide a full example that works in the playground and demonstrates this? The hypothetical you paste already has certain ambiguous issues (e.g. `var foo` and `func foo()` cannot compile together because of redefinition).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>This would not refer to either.  It cannot refer to Foo.bar because Foo has nothing to do with the array you are mapping over.</div></div></div></blockquote><div><br></div><div><div>The example I give works in the playground. Try it! :)</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>The syntax matching my example would be:</div><div><br></div><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>[1, 2, 3].map(.bar())</div></div></div></div></div></div></div></div></blockquote><div><br></div><div>This would be ambiguous with a static function, `bar()`, that return Self.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>In the enum example here you cannot refer to .Bar in an arbitrary context.  It must be known by context that you are referring to a case of Foo.  It appears to me like your understanding of the existing dot abbreviation for enums is not quite correct and this misunderstanding is probably contributing to your misunderstanding and confusion regarding my examples.</div></div></blockquote><div><br></div><div>I don&#39;t believe that I&#39;m misunderstanding, but I&#39;ll take working examples to the contrary.</div><div><br></div><div>Please try the examples I&#39;ve provided in a playground (and the SwiftStub link, above). I hope I&#39;ve clarified how dot abbreviation works! Let me know if you have any questions.</div><div><br></div><div>Stephen</div></div></div></div>