<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="">
`super` would only exhibit the proposed behavior when it is a standalone token. The expressions `super` and `super.widgetCount` are both permitted and both are exactly equivalent.
<div class=""><br class="">
</div>
<div class="">To express what you're suggesting with the extension (either with the current grammar or the proposed feature), it would be:</div>
<div class=""><br class="">
</div>
<div class=""><font face="Courier New" class="">override var widgetCount: Int {</font></div>
<div class=""><font face="Courier New" class="">&nbsp; &nbsp; return super.widgetCount.widgetCount &#43; 5</font></div>
<div class=""><font face="Courier New" class="">}</font></div>
<div class=""><br class="">
</div>
<div class="">Your example is not ambiguous because `super.widgetCount` only ever means the value of the widgetCount property in the superclass; `super` is not first evaluated to the aforementioned value and then `widgetCount` invoked on that result, since
 the entire `super.widgetCount` would be treated atomically, conceptually, as it is now.</div>
<div class=""><br class="">
</div>
<div class="">I can see that the fact that `super` itself does refer to an instance of T could be problematic for properties. For functions, if written as `super()` or `super(...)` so this should be OK and unambiguous. Perhaps the shorthand syntax could be
 limited to functions since they tend to be longer and in greater need of something like this in the first place.</div>
<div class="">
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Feb 9, 2016, at 12:28 AM, Radosław Pietruszewski &lt;<a href="mailto:radexpl@gmail.com" class="">radexpl@gmail.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">I want to say &#43;1.</div>
<div class=""><br class="">
</div>
<div class="">Ruby does this and it works really nicely. &nbsp;While not a big deal in simple cases, when a method has lots of arguments, it’s just really noisy.</div>
<div class=""><br class="">
</div>
<div class="">There’s a problem though. If `super` means both “call the superclass’s implementation of this method”, and “the superclass”, there’s a potential for ambiguity.</div>
<div class=""><br class="">
</div>
<div class="">Say:</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote type="cite" class="">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class="">
<div class="">
<div class="">
<div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">
<span class="" style="color: rgb(187, 44, 162);">override</span>&nbsp;<span class="" style="color: rgb(187, 44, 162);">var</span>&nbsp;widgetCount:&nbsp;<span class="" style="color: rgb(112, 61, 170);">Int</span>&nbsp;{</div>
<div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">
&nbsp; &nbsp;&nbsp;<span class="" style="color: rgb(187, 44, 162);">return</span>&nbsp;<span class="" style="color: rgb(187, 44, 162);">super</span>.widgetCount &#43;&nbsp;<span class="" style="color: rgb(39, 42, 216);">5</span></div>
<div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">
}</div>
</div>
</div>
</div>
</div>
</blockquote>
<br class="">
</div>
<div class="">And:</div>
<div class=""><br class="">
</div>
<blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class="">
<div class="">extension Int {</div>
<div class="">&nbsp; &nbsp; var widgetCount: Int { return 10 }</div>
<div class="">}</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Does&nbsp;<span class="" style="font-family: Menlo; font-size: 11px; color: rgb(187, 44, 162);">super</span><span style="font-family: Menlo; font-size: 11px;" class="">.widgetCount</span>&nbsp;call the superclass’s `widgetCount`, or does it call the superclass’s
 implementation of the same getter, then call `widgetCount` on the returned Int?</div>
<br class="">
<div class="">
<div class="">— Radek</div>
</div>
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 09 Feb 2016, at 06:31, Petroules Jake 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 style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hello,
<div class=""><br class="">
</div>
<div class="">I have a language syntax proposal. I've read the Swift evolution guidelines and hopefully this is the proper way to start. So, my proposal is:</div>
<div class=""><br class="">
</div>
<div class="">Permit a shorthand syntax for invoking the supertype implementation of a property or function. A single statement 'super' is equivalent to invoking the supertype implementation, forwarding the arguments unchanged, and returning the result. For
 example, the following samples:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<span style="color: rgb(187, 44, 162);" class="">override</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">func</span>&nbsp;mouseEntered(theEvent:&nbsp;<span style="color: rgb(112, 61, 170);" class="">NSEvent</span>) {</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">super</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
&nbsp; &nbsp;&nbsp;<span style="color: rgb(49, 89, 93);" class="">handleMouseEvent</span>(theEvent)</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
}</div>
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<div style="margin: 0px; line-height: normal;" class=""><span style="color: rgb(187, 44, 162);" class="">override</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">func</span>&nbsp;specialValue(key:&nbsp;<span style="color: rgb(112, 61, 170);" class="">String</span>)
 -&gt;&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div>
<div style="margin: 0px; line-height: normal; color: rgb(187, 44, 162);" class="">
<span style="" class="">&nbsp; &nbsp;&nbsp;</span>return<span style="" class="">&nbsp;</span>super<span style="" class="">&nbsp;&#43;&nbsp;</span><span style="color: rgb(39, 42, 216);" class="">1</span></div>
<div style="margin: 0px; line-height: normal;" class="">}</div>
<div style="margin: 0px; line-height: normal;" class=""><br class="">
</div>
<div style="margin: 0px; line-height: normal;" class="">
<div style="margin: 0px; line-height: normal;" class=""><span style="color: rgb(187, 44, 162);" class="">override</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">var</span>&nbsp;widgetCount:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div>
<div style="margin: 0px; line-height: normal; color: rgb(187, 44, 162);" class="">
<span style="" class="">&nbsp; &nbsp;&nbsp;</span>return<span style="" class="">&nbsp;</span>super<span style="" class="">&nbsp;&#43;&nbsp;</span><span style="color: rgb(39, 42, 216);" class="">5</span></div>
<div style="margin: 0px; line-height: normal;" class="">}</div>
</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">are exactly equivalent to the following samples:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<span style="color: rgb(187, 44, 162);" class="">override</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">func</span>&nbsp;mouseEntered(theEvent:&nbsp;<span style="color: rgb(112, 61, 170);" class="">NSEvent</span>) {</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">super</span>.<span style="color: rgb(61, 29, 129);" class="">mouseEntered</span>(theEvent)</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
&nbsp; &nbsp;&nbsp;<span style="color: rgb(49, 89, 93);" class="">handleMouseEvent</span>(theEvent)</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
}</div>
<div class="">
<div class=""><br class="webkit-block-placeholder">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<div style="margin: 0px; line-height: normal;" class=""><span style="color: rgb(187, 44, 162);" class="">override</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">func</span>&nbsp;specialValue(key:&nbsp;<span style="color: rgb(112, 61, 170);" class="">String</span>)
 -&gt;&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div>
<div style="margin: 0px; line-height: normal;" class="">&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">return</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">super</span>.specialValue(key) &#43;&nbsp;<span style="color: rgb(39, 42, 216);" class="">1</span></div>
<div style="margin: 0px; line-height: normal;" class="">}</div>
</div>
</div>
<div class=""><br class="webkit-block-placeholder">
</div>
<div class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<span style="color: rgb(187, 44, 162);" class="">override</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">var</span>&nbsp;widgetCount:&nbsp;<span style="color: rgb(112, 61, 170);" class="">Int</span>&nbsp;{</div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
&nbsp; &nbsp;&nbsp;<span style="color: rgb(187, 44, 162);" class="">return</span>&nbsp;<span style="color: rgb(187, 44, 162);" class="">super</span>.widgetCount &#43;&nbsp;<span style="color: rgb(39, 42, 216);" class="">5</span></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
}</div>
</div>
<div class=""><br class="">
</div>
<div class="">Alternatives/complementary ideas:</div>
<div class=""><br class="">
</div>
<div class="">- Require `<span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">super</span><span style="font-family: Menlo; font-size: 11px;" class="">()</span>` or `<span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">super</span><span style="font-family: Menlo; font-size: 11px;" class="">(...)</span>`
 syntax for invocations which are function calls, for consistency with other function calls in the language and/or to indicate that arguments are forwarded</div>
<div class=""><br class="">
</div>
<div class="">Looking forward to your feedback.</div>
<div class=""><br class="">
</div>
<div class="">Thanks!</div>
</div>
</div>
<div class="">
<div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
--&nbsp;<br class="">
Jake Petroules -&nbsp;<a href="mailto:jake.petroules@theqtcompany.com" class="">jake.petroules@theqtcompany.com</a><br class="">
Consulting Services Engineer -&nbsp;The Qt Company</div>
</div>
</div>
<br class="">
</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>
<br class="">
<div class="">
<div style="color: rgb(0, 0, 0); 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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); 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; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
--&nbsp;<br class="">
Jake Petroules -&nbsp;<a href="mailto:jake.petroules@theqtcompany.com" class="">jake.petroules@theqtcompany.com</a><br class="">
Consulting Services Engineer -&nbsp;The Qt Company</div>
</div>
</div>
<br class="">
</div>
</div>
</body>
</html>