<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Right.<div class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande';  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Félix</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 29 déc. 2015 à 15:04:11, Douglas Gregor &lt;<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Dec 29, 2015, at 11:48 AM, Félix Cloutier &lt;<a href="mailto:felixcca@yahoo.ca" class="">felixcca@yahoo.ca</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class="">Currently, they can be disambiguated using (self as ProtocolA).bar(), no?</div></div></blockquote><div class=""><br class=""></div>Not if ProtocolA has self requirements or associated types.&nbsp;<br class=""><blockquote type="cite" class=""><div class=""><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-family: 'Lucida Grande'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;">Félix</span>
</div>

<br class=""><div class=""><blockquote type="cite" class=""><div class="">Le 29 déc. 2015 à 14:10:51, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Talk about things you didn't know you needed until you see them. This is a really nice way of disambiguating!</div><div class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">-- E</div><br class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class="">On Dec 29, 2015, at 12:03 PM, Douglas Gregor via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class=""><br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Dec 29, 2015, at 10:17 AM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">We also have a problem with disambiguating same-named members that come from different extensions, whether via protocol extensions or independent concrete extensions from different modules. Could we extend this scheme to allow for disambiguating extension methods by protocol/module name?</div></blockquote><br class="">That's a fantastic idea!<div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""></div><div class="">extension ProtocolA { func foo() }</div><div class="">extension ProtocolB { func foo() }</div><div class=""><br class=""></div><div class="">public struct Foo: ProtocolA, ProtocolB {</div><div class="">&nbsp; func callBothFoos() {</div><div class="">&nbsp; &nbsp; self.`ProtocolA.foo`()</div><div class="">&nbsp; &nbsp; self.`ProtocolB.foo`()</div><div class="">&nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">import A // extends Bar with bar()</div><div class="">import B // also extends Bar with bar()</div><div class=""><br class=""></div><div class="">extension Bar {</div><div class="">&nbsp; func callBothBars() {</div><div class="">&nbsp; &nbsp; self.`A.bar`()</div><div class="">&nbsp; &nbsp; self.`B.bar`()</div><div class="">&nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">-Joe</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 26, 2015, at 11:22 PM, Douglas Gregor via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi all,<div class=""><br class=""></div><div class="">Here’s a proposal draft to allow one to name any function in Swift. In effect, it’s continuing the discussion of retrieving getters and setters as functions started by Michael Henson here:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/002168.html" class="">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/002168.html</a></div><div class=""><br class=""></div><div class="">the proposal follows, and is available here as well:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><a href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md" class="">https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md</a></div><div class=""><br class=""></div><div class="">Comments appreciated!</div><div class=""><br class=""></div><div class=""><h1 class="" style="box-sizing: border-box; font-size: 2.25em; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 1.2; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255); margin-top: 0px !important;">Generalized Naming for Any Function</h1><ul class="" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><li class="" style="box-sizing: border-box;">Proposal:&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0000-generalized-naming.md" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">SE-NNNN</a></li><li class="" style="box-sizing: border-box;">Author(s):&nbsp;<a href="https://github.com/DougGregor" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">Doug Gregor</a></li><li class="" style="box-sizing: border-box;">Status:&nbsp;<strong class="" style="box-sizing: border-box;">Awaiting Review</strong></li><li class="" style="box-sizing: border-box;">Review manager: TBD</li></ul><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);"><a id="user-content-introduction" class="anchor" href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md#introduction" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none; display: inline-block; padding-right: 2px; margin-left: -18px; line-height: 1;"><span class="octicon octicon-link" style="box-sizing: border-box; font-weight: normal; font-size: 16px; line-height: 1; font-family: octicons; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; -webkit-user-select: none; vertical-align: middle; visibility: hidden;"></span></a>Introduction</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">Swift includes support for first-class functions, such that any function (or method) can be placed into a value of function type. However, it is not possible to specifically name every function that is part of a Swift program---one cannot provide the argument labels when naming a function, nor are property and subscript getters and setters referenceable. This proposal introduces a general syntax that allows one to name anything that is a function within Swift in an extensible manner.</p><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">Swift-evolution thread: Michael Henson started a thread about the getter/setter issue&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/002168.html" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">here</a>, continued&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/002203.html" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">here</a>. See the&nbsp;<a href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md#alternatives-considered" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">Alternatives considered</a>&nbsp;section for commentary on that discussion.</p><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);"><a id="user-content-motivation" class="anchor" href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md#motivation" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none; display: inline-block; padding-right: 2px; margin-left: -18px; line-height: 1;"><span class="octicon octicon-link" style="box-sizing: border-box; font-weight: normal; font-size: 16px; line-height: 1; font-family: octicons; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; -webkit-user-select: none; vertical-align: middle; visibility: hidden;"></span></a>Motivation</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">It's fairly common in Swift for multiple functions or methods to have the same "base name", but be distinguished by parameter labels. For example,&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">UIView</code>&nbsp;has three methods with the same base name&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">insertSubview</code>:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> UIView {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">insertSubview</span>(view: UIView, at <span class="pl-smi" style="box-sizing: border-box;">index</span>: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span>)
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">insertSubview</span>(view: UIView, aboveSubview <span class="pl-smi" style="box-sizing: border-box;">siblingSubview</span>: UIView)
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">insertSubview</span>(view: UIView, belowSubview <span class="pl-smi" style="box-sizing: border-box;">siblingSubview</span>: UIView)
}</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">When calling these methods, the argument labels distinguish the different methods, e.g.,</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;">someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview(view, at: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">3</span>)
someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview(view, aboveSubview: otherView)
someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview(view, belowSubview: otherView)</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">However, when referencing the function to create a function value, one cannot provide the labels:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// ambiguous: could be any of the three methods</span></pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">In some cases, it is possible to use type annotations to disambiguate:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn: (UIView, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview    <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// ok: uses insertSubview(_:at:)</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn: (UIView, UIView) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// error: still ambiguous!</span></pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">To resolve the latter case, one must fall back to creating a closure:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn: (UIView, UIView) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> { view, otherView <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">in</span>
  button<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview(view, otherView)
}</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">which is painfully tedious. A similar workaround is required to produce a function value for a getter of a property, e.g.,</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> UIButton {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> currentTitle: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">String</span>? { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> fn: () <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">String</span>? <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> { () <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">in</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> button<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>currentTitle
}</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">One additional bit of motivation: Swift should probably get some way to ask for the Objective-C selector for a given method (rather than writing a string literal). The argument to such an operation would likely be a reference to a method, which would benefit from being able to name any method, including getters and setters.</p><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);"><a id="user-content-proposed-solution" class="anchor" href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md#proposed-solution" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none; display: inline-block; padding-right: 2px; margin-left: -18px; line-height: 1;"><span class="octicon octicon-link" style="box-sizing: border-box; font-weight: normal; font-size: 16px; line-height: 1; font-family: octicons; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; -webkit-user-select: none; vertical-align: middle; visibility: hidden;"></span></a>Proposed solution</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">Swift currently has a back-tick escaping syntax that lets one use keywords for names, which would otherwise fail to parse. For example,</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">`try`</span>() <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Bool</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">declares a function named&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">try</code>, even though&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">try</code>&nbsp;is a keyword. I propose to extend the back-tick syntax to allow compound Swift names (e.g.,&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">insertSubview(_:aboveSubview:)</code>) and references to the accessors of properties (e.g., the getter for&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">currentTitle</code>). Specifically,</p><ul class="" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><li class="" style="box-sizing: border-box;"><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">Compound names can be written entirely within the back-ticks, e.g.,</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`insertSubview(_:at:)`
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn1 <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`insertSubview(_:aboveSubview:)`</pre></div><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">The same syntax can also refer to initializers, e.g.,</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> buttonFactory <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> UIButton<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">init</span>(type:)`</pre></div></li><li class="" style="box-sizing: border-box;"><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">Getters and setters can be written using dotted syntax within the back-ticks:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> specificTitle <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> button<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`currentTitle<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span>` <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// has type () -&gt; String?</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> otherTitle <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> UIButton<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`currentTitle<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span>`  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// has type (UIButton) -&gt; () -&gt; String?</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> setTintColor <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> button<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`tintColor<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">set</span>`     <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// has type (UIColor!) -&gt; ()</span></pre></div><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">The same syntax works with subscript getters and setters as well, using the full name of the subscript:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> Matrix {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span> (row row: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Int</span>) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> [<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Double</span>] {
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">set</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }
  }
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> getRow <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someMatrix<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span>(row:)<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span>` <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// has type (Int) -&gt; () -&gt; [Double]</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> setRow <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someMatrix<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span>(row:)<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">set</span>` <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// has type (Int) -&gt; ([Double]) -&gt; ()</span></pre></div><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">If we introduce property behaviors into Swift, the back-tick syntax could also be used to refer to behaviors, e.g., accessing the&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">lazy</code>&nbsp;behavior of a property:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`myProperty<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">lazy</span>`<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>clear()</pre></div></li><li class="" style="box-sizing: border-box;"><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">Base names that are meaningful keywords (<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">init</code>&nbsp;and&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">subscript</code>) can be escaped with a nested pair of back-ticks:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> Font {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">`subscript`</span>() <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> Font {
    <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// return the subscript version of the given font</span>
  }
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> getSubscript <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> font<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>``<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span>`()` <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// has type () -&gt; Font</span></pre></div></li></ul><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">The "produce the Objective-C selector for the given method" operation will be the subject of a separate proposal. However, here is one possibility that illustrations how it uses the proposed syntax here:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> getter: Selector <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> objc_selector(NSDictionary<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span>(_:)<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span>`) <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// produces objectForKeyedSubscript:</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> setter: Selector <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> objc_selector(NSDictionary<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>`<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span>(_:)<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">set</span>`) <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// produces setObject:forKeyedSubscript:</span></pre></div><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);"><a id="user-content-impact-on-existing-code" class="anchor" href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md#impact-on-existing-code" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none; display: inline-block; padding-right: 2px; margin-left: -18px; line-height: 1;"><span class="octicon octicon-link" style="box-sizing: border-box; font-weight: normal; font-size: 16px; line-height: 1; font-family: octicons; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; -webkit-user-select: none; vertical-align: middle; visibility: hidden;"></span></a>Impact on existing code</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);">This is a purely additive feature that has no impact on existing code. The syntactic space it uses is already present, and it merely extends the use of back-ticks from storing a single identifier to more complex names.</p><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);"><a id="user-content-alternatives-considered" class="anchor" href="https://github.com/DougGregor/swift-evolution/blob/generalized-naming/proposals/0000-generalized-naming.md#alternatives-considered" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none; display: inline-block; padding-right: 2px; margin-left: -18px; line-height: 1;"><span class="octicon octicon-link" style="box-sizing: border-box; font-weight: normal; font-size: 16px; line-height: 1; font-family: octicons; display: inline-block; text-rendering: auto; -webkit-font-smoothing: antialiased; -webkit-user-select: none; vertical-align: middle; visibility: hidden;"></span></a>Alternatives considered</h2><ul class="" style="box-sizing: border-box; padding: 0px 0px 0px 2em; margin-top: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255); margin-bottom: 0px !important;"><li class="" style="box-sizing: border-box;"><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">Michael Henson&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/002168.html" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">proposed</a>&nbsp;naming getters and setters using&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#</code>&nbsp;syntax followed by&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">get</code>&nbsp;or&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">set</code>, e.g.,</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> specificTitle <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> button<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>currentTitle#<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span></pre></div><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">The use of postfix&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#</code>&nbsp;is a reasonable alternative here, and more lightweight than two back-ticks for the simple getter/setter case. The notion could be extended to allow argument labels for functions, discussed&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/002210.html" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">here</a>. The proposals in that discussion actually included type annotations as well, but the syntax seems cleaner---and more directly focused on&nbsp;<em class="" style="box-sizing: border-box;">names</em>---without them, e.g.,:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview#(_:at:)</pre></div><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">which works. I didn't go with this syntax because (1) it breaks up Swift method names such as&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">insertSubview(_:at:)</code>with an&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#</code>&nbsp;in the middle, and (2) while useful, this feature doesn't seem important enough to justify overloading&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#</code>further.</p></li><li class="" style="box-sizing: border-box;"><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">Joe Groff&nbsp;<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/003008.html" class="" style="box-sizing: border-box; background-color: transparent; color: rgb(64, 120, 192); text-decoration: none;">notes</a>&nbsp;that&nbsp;<em class="" style="box-sizing: border-box;">lenses</em>&nbsp;are a better solution than manually retrieving getter/setter functions when the intent is to actually operate on the properties. That weakens the case this proposal makes for making getters/setters available as functions. However, it doesn't address the general naming issue or the desire to retrieve the Objective-C selector for a getter/setter.</p></li><li class="" style="box-sizing: border-box;"><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">Can we drop the back-ticks? It's very tempting to want to drop the back-ticks entirely, because something like</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> someView<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>insertSubview(_:at:)</pre></div><p class="" style="box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;">can be correctly parsed as a reference to&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">insertSubview(_:at:)</code>. However, it breaks down at the margins, e.g., with getter/setter references or no-argument functions:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px;"><pre class="" style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Optional</span> {
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">get</span>() <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> T { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">!</span> }
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn1 <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> button<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>currentTitle<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span>   <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// getter or Optional&lt;String&gt;.get?</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> fn2 <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">set</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>removeAllElements()   <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">// call or reference?</span></pre></div></li></ul><div class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>- Doug</div><div class=""><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=RoDF4MveSEMYBIqIJA6ub1g8cOZ-2BVYvqV-2FqygPhjPn9U5sWpFYkd-2FHUCd7ij1TjSXW4-2BtO8epd3h4Vc9nfcgirn6DzSGYDX8yBAa7mAb2BUs8n2lyAJ3ITKw4dQR7q7mGEbmmD03PAjh217J54CuiBf3AaphHnegJBeugOY98fskeyxev3uVoA6wn9cbL2Yp7ihE0DNoAhHQ-2FTo2mXCpviLLiMxkIBBdr-2FTU0-2Fu4ytU-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=r5jpKsi6nat7oa43lpCLi5GRGm2utDkbDscuFklXZ2dHcLHc57eyZaUlj3pzgfpn98NnU8VKP4P1tmwV7MVA2kS-2BY6zkI3PYNu8yMxlmc-2FUoO8mffp3u7bGEfgY597ZMx9T95iZ9gvdU2bwk-2FDE-2FtO9vKSEm-2BZNehUr1jOXxV0DK-2FA8g2SQJaQLUlvaLe1n1GaZGZoxl7H2q7Z4OImWnpPtwlKUXLVkNzdN1y3HXjVg-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class="" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=iRI3beHTe3UxYAHTlV3lA38zIPfHMhyuRzgTmGKV6k5p6zDe3dwn-2FWfRsP7mKdptMO4dQHdJFdZ0E-2Fg-2BHCwRDrNW2zYCf9lO5kXGR8V8Z3UtilcNaeO8mpRO9o3IxO-2ByZCOfGZ-2Blwl1vTL9fkwhlJnb3NTpdQIIbUU-2BIGE-2Fo4Astg1hhpzXKVn2AbqxqTeh-2FwGM8JByHe38iQzImOyiBLqksVWSC5erCYfeF0ocGxeg-3D" alt="" width="1" height="1" border="0" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></body></html>