On 03/11/06, Artur Merke <am / artbot.de> wrote:
> Just a short question concerning the ruby lexer/parser
>
> irb(main):001:0> a=1
> => 1
> irb(main):002:0> a.to_f * 10.0   #space before and after '*'
> => 10.0
> irb(main):003:0> a.to_f*10.0   #no space before and after '*'
> => 10.0
>
> irb(main):005:0* a.to_f *10.0   #space before '*' and no space after
> '*'
> ArgumentError: wrong number of arguments (1 for 0)
>         from (irb):5:in `to_f'
>         from (irb):5
>
> so why does ruby think *10.0 would be an argument to .to_f?
>
> In my opinion the ruby lexer sould recognize '*' as an operator, no
> spacing should
> have any influence on this behavior ...
>
>
> Artur

* can have dual meanings. It can be a method call on an object (in
your first two examples) or it can act as the 'splat' operator when it
directly preceeds an object.

Farrel