<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="">How about this:<div class=""><br class=""></div><div class="">Assuming behaviors are <b class="">extensions</b> of <b class="">var</b> (and maybe <b class="">let</b> in the future) and showing these extensions, just like file extensions appended with dot:<br class=""><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(167, 29, 93); background-color: rgb(247, 247, 247);" class="">var<span style="font-kerning: none; color: #323333" class="">.</span>lazy<span style="font-kerning: none; color: #323333" class=""> foo </span>=<span style="font-kerning: none; color: #323333" class=""> </span><span style="font-kerning: none; color: #0086b3" class="">1738</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">var</span> <span style="font-kerning: none; color: #a71d5d" class="">extension</span> lazy<span style="font-kerning: none; color: #a71d5d" class="">&lt;</span>Value<span style="font-kerning: none; color: #a71d5d" class="">&gt;</span> <span style="font-kerning: none; color: #a71d5d" class="">=</span> initialValue {</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; <span style="font-kerning: none; color: #a71d5d" class="">var</span> value: Value? <span style="font-kerning: none; color: #a71d5d" class="">=</span> <span style="font-kerning: none; color: #0086b3" class="">nil</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(167, 29, 93); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #323333" class="">&nbsp; </span>mutating<span style="font-kerning: none; color: #323333" class=""> </span>get<span style="font-kerning: none; color: #323333" class=""> {</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; <span style="font-kerning: none; color: #a71d5d" class="">if</span> <span style="font-kerning: none; color: #a71d5d" class="">let</span> value <span style="font-kerning: none; color: #a71d5d" class="">=</span> value {</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; &nbsp; <span style="font-kerning: none; color: #a71d5d" class="">return</span> value</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; <span style="font-kerning: none; color: #a71d5d" class="">let</span> initial <span style="font-kerning: none; color: #a71d5d" class="">=</span> initialValue</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; value <span style="font-kerning: none; color: #a71d5d" class="">=</span> initial</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; <span style="font-kerning: none; color: #a71d5d" class="">return</span> initial</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; }</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; <span style="font-kerning: none; color: #a71d5d" class="">set</span> {</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; &nbsp; value <span style="font-kerning: none; color: #a71d5d" class="">=</span> newValue</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">&nbsp; }</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">}</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">var</span> <span style="font-kerning: none; color: #a71d5d" class="">extension</span> resettable<span style="font-kerning: none; color: #a71d5d" class="">&lt;</span>Value<span style="font-kerning: none; color: #a71d5d" class="">&gt;</span> <span style="font-kerning: none; color: #a71d5d" class="">=</span> initialValue {</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(42, 142, 69); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #323333" class="">&nbsp; </span>//...</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">&nbsp; func </span>reset() {<span style="font-kerning: none; color: #a71d5d" class=""> </span><span style="font-kerning: none; color: #2a8e45" class="">/**/</span><span style="font-kerning: none; color: #a71d5d" class=""> </span>}</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(167, 29, 93); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">}</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(42, 142, 69); background-color: rgb(247, 247, 247);" class="">// Declare valid composition, enforcing order or composition:</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="color: rgb(167, 29, 93);" class="">resettable</span>&nbsp;<span style="font-kerning: none; color: #a71d5d" class="">extension</span>&nbsp;lazy<span style="font-kerning: none; color: #a71d5d" class="">&lt;</span>Value<span style="font-kerning: none; color: #a71d5d" class="">&gt;</span> <span style="font-kerning: none; color: #a71d5d" class="">=</span> initialValue {</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class="">&nbsp;&nbsp;<span style="color: rgb(167, 29, 93);" class="">var.</span><span style="color: rgb(167, 29, 93);" class="">resettable</span>&nbsp;value: Value?&nbsp;<span style="color: rgb(167, 29, 93);" class="">=</span>&nbsp;<span style="color: rgb(0, 134, 179);" class="">nil</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(42, 142, 69); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #323333" class="">&nbsp; </span>//...</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">&nbsp; override&nbsp;func </span>reset() {&nbsp;<span style="color: rgb(42, 142, 69);" class="">/**/</span><span style="font-kerning: none; color: #a71d5d" class="">&nbsp;</span>}</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(167, 29, 93); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">}</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="font-kerning: none; color: #a71d5d" class="">lazy</span>.<span style="font-kerning: none; color: #a71d5d" class="">resettable</span> property1: Double = 3.1415927</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class=""><span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="font-kerning: none; color: #a71d5d" class="">resettable </span>property2: Int = 123</div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">property1.<span style="font-kerning: none; color: #a71d5d" class="">var</span>.reset() <span style="font-kerning: none; color: #2a8e45" class="">// Not shadowed</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">property2.<span style="font-kerning: none; color: #a71d5d" class="">var</span>.reset() <span style="font-kerning: none; color: #2a8e45" class="">// Not shadowed</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(42, 142, 69); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">property1.<span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="font-kerning: none; color: #a71d5d" class="">lazy</span>.<span style="font-kerning: none; color: #a71d5d" class="">resettable</span>.reset() <span style="font-kerning: none; color: #2a8e45" class="">// Full Path</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">property1.<span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="font-kerning: none; color: #a71d5d" class="">resettable</span>.reset() <span style="font-kerning: none; color: #2a8e45" class="">// Full Path</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">property1.<span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="font-kerning: none; color: #a71d5d" class="">_</span>.<span style="font-kerning: none; color: #a71d5d" class="">resettable</span>.reset() <span style="font-kerning: none; color: #2a8e45" class="">// Wild-card path</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247);" class="">property2.<span style="font-kerning: none; color: #a71d5d" class="">var</span>.<span style="font-kerning: none; color: #a71d5d" class="">_</span>.<span style="font-kerning: none; color: #a71d5d" class="">resettable</span>.reset() <span style="font-kerning: none; color: #2a8e45" class="">// Wild-card path</span></div><div style="margin: 0px; font-size: 10px; line-height: normal; font-family: Menlo; color: rgb(50, 51, 51); background-color: rgb(247, 247, 247); min-height: 11px;" class=""><br class=""></div></div><div class=""><br class=""></div><div class="">This way we don’t have any new keywords or overloading symbols like # and @ with new meanings. The use of dot, I think seems the most natural. <b class="">property.<font color="#a71d5d" class="">var</font>.*</b> creates a distinct namespace and since var is already a keyword, does not collide with anything.&nbsp;</div><div class=""><br class=""></div><div class="">The same logic may also work for defining function decorators as func extension remote… (decorator/behavior declaration) and func.remote f() (function declaration) f.func.connect() (member invocation)</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 14, 2016, at 12:36 PM, Brent Royal-Gordon 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=""><blockquote type="cite" class="">I’m sorry if this has already been discussed, but what are the drawbacks of putting the variable's behaviors before the ‘var’ keyword? &nbsp;Like this:<br class=""><br class="">lazy synchronized var x:SomeType<br class=""></blockquote><br class="">With no prefix at all, this limits our ability to introduce declaration modifiers in the future. For instance, if the people clamoring for a `local` access modifier win in Swift 4, anyone who wrote a behavior called `local` will be very sad.<br class=""><br class="">The other problem is, with this declaration:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>lazy var array = [1, 2, 3]<br class=""><br class="">It offers no way to disambiguate between the two meanings of `lazy`:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>array.lazy.reset()<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>array.lazy.map { ... }<br class=""><br class="">Personally, if we're not going to use the `[]` syntax, I think we should use the `@` prefix and think of all uses of `@` throughout the language as eventual targets for behavior-ization (even if we don't get around to most of them in Swift 3, or some of them ever). It would be nice to have a rational explanation for what `@` means. But I'm reasonably happy with the `[]` syntax.<br class=""><br class="">-- <br class="">Brent Royal-Gordon<br class="">Architechies<br class=""><br 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></div></blockquote></div><br class=""></div></div></body></html>