[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01166] Re: Is this expected behavior?

From: Dave Thomas <Dave@...>
Date: 2000-01-23 16:06:33 UTC
List: ruby-talk #1166
matz@netlab.co.jp (Yukihiro Matsumoto) writes:

> because it is processed by single rule, and it does already.  But
> 
>   p (a).foo
> 
> is processed by multiple rules, and I don't to how to detect this as
> ambiguous.  Any good idea?

I doubt it ;-)

Have you ever considered the idea of having two different precedence
method calls? For example, putting a colon after a method invocation
reduces its precedence down very low.

   p (-1).abs     -> undefined method 'abs' for 'nil'

   p: (-1).abs    -> 1

So in general

   method: <any expression>

would be equivalent to

   method(expression)

while

   method expression

would parse as now.


I know this adds extra stuff to the language, and that you're probably
holding ':' in reserve for keyword parameters, but maybe it'll trigger
something closer to a good solution.


Regards

Dave

In This Thread

Prev Next