<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=""><div class="">I don’t think using a let constant should prevent a further sub-class from overriding again, that’s what the final keyword should be for.</div><div class=""><br class=""></div><div class="">It would still need to be implemented like this behind the scenes though:</div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>override<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>var<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> x:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> { </span>return<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">7</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> }</span></div></div><div class=""><br class=""></div><div class="">By the same token you could also allow var to implicitly create something like the following:</div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><div style="margin: 0px;" class="">&nbsp; &nbsp;&nbsp;<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">private</span> <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">var</span> _x = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">7</span></div><div style="margin: 0px; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>override<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>private(set)<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>var<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> x:</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div><div style="margin: 0px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">get</span> { <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">_x</span> }</div><div style="margin: 0px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">set</span> { <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">_x</span> = newValue }</div><div style="margin: 0px;" class="">&nbsp; &nbsp; }</div></div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div>I’m not sure what my preference is though; while being able to do overrides with stored property-like syntax might be convenient and tidy in some cases, it’s probably better to force developers to use explicitly computed properties to be clear what’s really going on to make it actually work.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 23 Apr 2016, at 20:30, Adrian Zubarev 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 id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class="">I already see the problem here:</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class="">class A { var x: Int { return 42 } }</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class="">class B: A { override let x = 7 } // assume that will work</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class="">class C: B { override var x: Int { /* wait this wont work anymore */ } }</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class="">You won’t be able to override an immutable constant.</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class=""><br class=""></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class="">I don’t like such a change.</div><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px;" class=""><br class=""></div><div id="bloop_sign_1461439398754067968" class="bloop_sign" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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: helvetica, arial; font-size: 13px;" class="">--&nbsp;<br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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=""><p class="airmail_on" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">Am 23. April 2016 bei 21:19:27, Roman Zhikharevich via swift-evolution (<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>) schrieb:</p><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><span class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""></div><div class="">I think, it could be a good idea to make computed properties overridable with let constants.<div class=""><br class=""></div><div class="">Something like this:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(131, 148, 150);"><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(133, 153, 1);">class</span><span class="Apple-converted-space">&nbsp;</span><span class="">Parent {</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(133, 153, 1);">var</span><span class="Apple-converted-space">&nbsp;</span><span class="">x:</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(133, 153, 1);">Int</span><span class="Apple-converted-space">&nbsp;</span><span class="">{</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(133, 153, 1);">let</span><span class="Apple-converted-space">&nbsp;</span><span class="">x =</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(41, 161, 152);">42</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(88, 110, 117);"><i class="">/*</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; * Compute x...</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; */</i></span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(133, 153, 1);">return</span><span class="Apple-converted-space">&nbsp;</span><span class="">x</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">}</span></div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="color: rgb(133, 153, 1);">class</span><span class="Apple-converted-space">&nbsp;</span><span class="">Child:</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(181, 137, 1);">Parent</span><span class="Apple-converted-space">&nbsp;</span><span class="">{</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(88, 110, 117);"><i class="">/*</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; * Sometimes you need to override computed properties with simple constants.</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; * This is currently done like this.</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; */</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class="" style="color: rgb(131, 148, 150);">&nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class=""><i class="">//override var x: Int {return 7}</i></span></div><div style="margin: 0px; line-height: normal;" class=""><span class="">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; line-height: normal;"><span class="">&nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(88, 110, 117);"><i class="">/*</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; * But this looks neater.</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; * Currently this gives "error: cannot override with a stored property 'x'".</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(88, 110, 117);"><span class=""><i class="">&nbsp;&nbsp; &nbsp; */</i></span></div><div class="" style="margin: 0px; line-height: normal; color: rgb(133, 153, 1);"><span class="" style="color: rgb(131, 148, 150);">&nbsp; &nbsp;</span><span class="Apple-converted-space">&nbsp;</span><span class="">override</span><span class="Apple-converted-space">&nbsp;</span><span class="">let</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(131, 148, 150);">x =</span><span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(41, 161, 152);">7</span></div><div class="" style="margin: 0px; line-height: normal;"><span class="">}</span></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></span></blockquote><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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></body></html>