From: Gary Wright Date: 2007-07-10T04:08:26+09:00 Subject: Re: Syntax sugar: method[](...) => method(...) On Jun 30, 2007, at 3:18 AM, Yukihiro Matsumoto wrote: > In message "Re: Syntax sugar: method[](...) => method(...)" > on Sat, 30 Jun 2007 05:17:27 +0900, "Erwin Abbott" > writes: > > |Lastly, has there been any mention of allowing function names like so > |in ruby 1.9: > | def logins[] date > | # ... > | end > > It is quite difficult since > > obj.login[date] > > would be ambiguous. We have no way to tell the method name to be > "login[]" or "login". I've wished for the functionality the OP suggested but I understand that there really isn't much wiggle room in the current Ruby syntax. This would probably be a headache from a parsing perspective but what about something like: obj.login@[date] which would be interpreted as calling the method named 'login@[]'. This is suggestive of the Eiffel array indexing syntax but with the square brackets to avoid any ambiguity with instance variables. Gary Wright