<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">In ruby, parens are optional. So,<div class=""><br class=""></div><div class="">v = foo.value</div><div class=""><div><br class=""></div><div>and</div><div><br class=""></div><div><div class="">v = foo.value()</div><div class=""><br class=""></div><div class="">are identical. There dot syntax is only used for method invocation, so there is no external access to instance variables without some twiddling; similarly getting access to a Proc/lambda/Method requires twiddling in Ruby (although there are shortcuts in normal use, like Symbol#to_proc)</div><div class=""><br class=""></div><div class="">Ruby class implementations often expose a getter and/or setter for instance variables - under the function names example_value() and example_value=(). If instance variables/class variables are not exposed in this manner, then the expectation is that you weren’t meant to see/manipulate them, and do so at your own peril.</div><div class=""><br class=""></div><div class="">For mapping to Swift, I would say that parens are needed; we can’t guess whether a `foo.bar` is meant to be asking for the value of attribute bar or a reference to method bar.</div><div class=""><br class=""></div><div class="">More difficult would be the use of ‘=‘, ‘!’, and ‘?’ - all legal in Ruby method names as suffixes. ‘=‘ as already stated is used for setters, ‘!’ for differentiating mutating operations, and ‘?’ to indicate the result is boolean (or sometimes just ‘truthy’ , as every object other than false and nil evaluate to true)</div><div class=""><br class=""></div><div class="">I could imagine tricks to make `foo.bar = 1` work, but I’m not sure what would be an appropriate way to represent ! and ? methods.</div><div class=""><br class=""></div><div class="">-DW</div><div class=""><br class=""></div></div></div><div><blockquote type="cite" class=""><div class="">On Nov 20, 2017, at 1:10 PM, Chris Lattner 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 20, 2017, at 10:50 AM, Slava Pestov 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=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Nov 20, 2017, at 1:39 PM, Chris Lattner 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=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It is straight-forward (and fits very very naturally into the Swift call model) to support the second one as an atomic thing, which is I think what you’re getting at.<span class="Apple-converted-space">&nbsp;</span></span></div></blockquote></div><br class=""><div class="">What if you write ‘let fn = obj.method’?</div></div></div></blockquote><br class=""></div><div class="">That’s related to the DynamicMemberLookup proposal. &nbsp;I’m not familiar with Ruby, but it sounds like the implementation would end up calling&nbsp;rb_iv_get/set to manipulate instance variables. &nbsp;Is that your question or are you asking something else?</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div><br class=""></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></blockquote></div><br class=""></body></html>