<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="">+1<div class=""><br class=""></div><div class="">I like the #get, #set suffixes.</div><div class=""><br class=""></div><div class="">I’m afraid the following would be a bit ambiguous</div><div class=""><blockquote type="cite" class="">&nbsp;- example.init(argument:Int, another:String)</blockquote><blockquote type="cite" class="">&nbsp;- example.subscript(index:Int)</blockquote><br class=""></div><div class="">Maybe with ‘#’ too</div><div class="">&nbsp;- example.init#argument:Int#another:String<br class="">&nbsp;- example.init#argument#another<br class="">&nbsp;- example.init#(argument:Int, another:String)<br class="">&nbsp;- example.subscript#index:Int<br class="">&nbsp;- example.subscript#Int<br class=""></div><div class=""><br class=""><div class="">
<div class="">Pierre</div>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 14 déc. 2015 à 08:57, ilya 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" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;" class=""><div class="">&gt; Being able to refer to getters and setters is a good idea and aligns with being able to refer to initializers and methods.</div><div class="">&gt; I would also add subscripts to the list if possible.</div><div class=""><br class=""></div><div class="">Great idea! Let's discuss syntax</div><div class=""><br class=""></div><div class="">How about&nbsp;</div><div class="">&nbsp;- example.get.member</div><div class="">&nbsp;- example.set.member</div><div class="">&nbsp;- example.init(argument:Int, another:String)</div><div class="">&nbsp;- example.subscript(index:Int)</div><div class=""><br class=""></div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;"><br class=""><div class="gmail_quote">On Mon, Dec 14, 2015 at 3:49 AM, Marc Knaup via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class="">Wait, where is stated that KVO is a long-term goal for Swift? I might have missed that.<div class=""><br class=""><div class="">I find that one of Objective-C's most annoying features. It makes it really difficult to reason about code when things can happen unexpectedly left and right. It's the same issue with aspect-oriented programming.</div></div><div class=""><br class=""></div><div class="">I prefer explicit integration points like closures, delegates and alike.</div><div class="">Most times I used KVO in the past was to work around bugs or annoyances on iOS, like for example forcing a button stay enabled even when iOS disables it.</div><div class=""><br class=""></div><div class="">Also it's unlikely that all mutable properties will support observation automatically. That would require the optimizer to keep using dynamic dispatch for all of them which will hurt performance.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">But I'm getting off-topic since your discussion is not about KVO nor about KVC.</div><div class=""><br class=""></div><div class="">Being able to refer to getters and setters is a good idea and aligns with being able to refer to initializers and methods.</div><div class="">I would also add subscripts to the list if possible.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="h5">On Mon, Dec 14, 2015 at 1:34 AM, Michael Henson via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""></div></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class=""><div class="h5"><div dir="ltr" class="">Swift-like full KVO/KVC as in Objective-C is a stated long-term goal for Swift's evolution. The 90% solution might be more straightforward:<br class=""><br class="">class Example {<div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>var member: String</div><div class=""><br class=""></div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>func print() {</div><div class="">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span>print(self.member)</div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>}</div><div class="">}<br class=""><br class="">var example = Example(member: "Hi!")<br class=""><br class="">var example_print_method = example.print</div><div class="">example_print_method()</div><div class="">result:</div><div class="">Hi!<br class=""><br class=""></div><div class="">If there were a mechanism for referring to the getter and setter methods on the var member property as the same kind of self-capturing closures, it could make simple cases of data binding easier to implement:<br class=""><br class="">var serializeFields = [<br class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>"member": example.member#get,<br class="">]<br class=""><br class="">var deserializeFields = [</div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>"member": example.member#set,</div><div class="">]<br class=""><br class="">var broadcastValueTo = [</div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>"memberValues": [</div><div class="">&nbsp; &nbsp; &nbsp;example.member#set,</div><div class="">&nbsp; &nbsp; &nbsp;example2.member#set,</div><div class="">&nbsp; &nbsp; &nbsp;example3.member#set,</div><div class="">&nbsp;<span class="Apple-converted-space">&nbsp;</span>]</div><div class="">]</div><div class=""><br class=""></div><div class="">viewController.textField.onValueChanged(example.member#set)<br class=""><br class="">Etc.<br class=""><br class="">The "#" notation is just a placeholder for "whatever mechanism is decided upon", though it does seem to be available and using it postfix makes a first-glance sense to me in terms of the semantics of expressions.<br class=""><br class="">Mike</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=6ZGE61OxINd5lLe2xYh9Ku-2BXbixWNr2nvfzp2IB1sZh6tc4kNzfJcSTqpLpEpH526-2BDHnMIJXzBIwTZyK993UjcBHcizeFq0ouH89BEHchKyyDVYPv-2F03mof502YPS9lhbAWBeAhS-2Fu2v8-2BwutM-2FO2Epc1GCFAfJPwBGKc0YwjDX8IVV4On-2F34K2PM7RgUGXNTTX1VqCS3MEhBYrDQJDfB-2F0FVymTzFL3UbyYGnFgYI-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span class="Apple-converted-space">&nbsp;</span><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=1p9Jer2O6jVE9KWvo-2B9iUaEyN8slp4IizyiLwsfp54PEP1k3HuN7Q-2FAJKrF227ugqk4jUa030yyR7GFlXlLYzikP14xh5x6W2mSnFWhM2sRqtYV02AGXyRukE4KDh8tGo-2FJlDAp2PjnHKWVCngRHt-2BAbjQWeorNG5xME4E87CTrOc2mTa4quf2LJSP03y8sUIF7NyYL4JnD39lvZQx8chCYT87ynxgZBWUcuhrB7xLw-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span class="Apple-converted-space">&nbsp;</span><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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ST9LHNQ2kYRKURQJ7G-2FmGCudH8brFLVBGfh-2Becw1t9jMUkD-2FWTHCl5yIgQBEoGw1nNIbVLdA6FPslIVRdxWCwZ1otSrsRZ2vt0zREPT-2FZzDx-2FXtTVZYQPsw4G9ad-2BfZHOYLrf6dTbO0vh593RGeOEDM7ubImyBjKtw6a5MFzGkKxY-2FMJoQEGL6Z-2Bo-2FriaSsywjMiRKXJdhRsr4tRAT4fcscDrvXW7FbWlCyl4s0nKZI-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; 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;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></body></html>