<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">David, I'm thinking about the side effects calling a computed property has and although I see some use cases for let properties I also see workarounds. For example, a lazy initialiser will solve the issue of running a certain code only once and caching its value. I also start to think that any case in this proposal will be solved by lazy initialisers thus rendering it unnecessary.</div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><br></div></div></div></div>
<br><div class="gmail_quote">On 17 May 2016 at 17:50, David Sweeris <span dir="ltr"><<a href="mailto:davesweeris@mac.com" target="_blank">davesweeris@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>You can't, if you're extending a pre-existing type.<br><br>I'd think that it might be possible to do some caching if the compiler knows that a computed property is constant, but maybe it doesn't work that way.</div><div><br></div><div>- Dave Sweeris</div><div><div class="h5"><div><br>On May 17, 2016, at 14:40, Leonardo Pessoa via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div style="font-family:trebuchet ms,sans-serif">If the value of the property is a constant, shouldn't you just declare it as one? If you have any sort of computation in it, even concatenating two constant strings, can you really say this is a constant? And you would also be overloading the compiler into trying to check for every property you use let if the overall computation is constant or not. IMO, let isn't really the most appropriate keyword to use for properties.</div></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><div dir="ltr"><font face="trebuchet ms, sans-serif">- Leonardo</font></div></div></div></div></div>
<br><div class="gmail_quote">On 13 May 2016 at 04:44, Andru Felipe Zuniga via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It would be useful for clarification of a computed property being constant in extensions. For example:<br>
<br>
extension SKSpriteNode {<br>
static let type: String {<br>
return “Sprite”<br>
}<br>
}<br>
<br>
Andru<br>
<br>
<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></div></blockquote></div><br></div></div>