<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="">Have you heard of the property behaviors proposal?<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span>
</div>

<br class=""><div style=""><blockquote type="cite" class=""><div class="">Le 5 janv. 2016 à 08:48:03, James Campbell 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 dir="ltr" class=""><div class="">When creating a lazy variable, maybe we should allow for default closures, i.e</div><div class=""><br class=""></div><div class="">lazy var&nbsp;userSession: UserSession</div><div class=""><br class=""></div><div class="">Which will construct that object for you</div><div class="">instead of having to do:</div><div class=""><br class=""></div><div class=""><div class="">lazy var object: MyObject {</div><p class=""><span class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="">let</span><span class="">&nbsp;userSession =&nbsp;</span><span class="">UserSession</span><span class="">()</span></p><p class=""><span class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="">return</span><span class="">&nbsp;userSession</span></p><p class=""><span class="">}()</span></p><p class="">If the initializer requires parameter values then as an extension of this we could pass them in psuedo C++ style:</p><p class="">lazy var object:&nbsp;UserSession(otherVariable)&nbsp;<br class=""></p><p class="">Potentially otherVariable in this case could be lazily processed, so that its the equivalent of:</p><div class=""><br class=""></div><div class=""><div class="">lazy var object: MyObject {</div><p class=""><span class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="">let</span><span class="">&nbsp;userSession =&nbsp;</span><span class="">UserSession</span><span class="">(</span>otherVariable)</p><p class=""><span class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="">return</span><span class="">&nbsp;userSession</span></p><p class=""><span class="">}()</span></p></div></div><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><span style="font-size:16px;line-height:19.2px" class=""></span><span style="font-size:12.8px" class="">&nbsp;Wizard</span><br class=""></div><div class=""><a href="mailto:james@supmenow.com" target="_blank" class="">james@supmenow.com</a></div><div class="">+44 7523 279 698</div></div></div></div></div></div>
</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=iRI3beHTe3UxYAHTlV3lA38zIPfHMhyuRzgTmGKV6k4xopo1RLJYTtnl4B7QGCX31HkJOYp6qIpnKHsMr2XBPEA38LR2O7MEicWA0-2FZSOJC2YANI-2B2YMtHJ9iZjLJh0nnVGiV6UjBKtoc9TbzhHktpux3XvIGONANUmZ-2BCkfoUcTzSTUNNCQKBXFXnsp4xGD3wpAnHgIGYcZU-2BvgRxxs0i3pE-2B7OpJG4wnANHNYse-2F4-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<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></blockquote></div><br class=""></body></html>