[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Bug: Syntax error when using 'or' keyword

dblack

3/24/2006 6:23:00 PM

3 Answers

Daniel Harple

3/24/2006 7:06:00 PM

0

On Mar 24, 2006, at 7:22 PM, dblack@wobblini.net wrote:

> There was a thread about this recently on ruby-core. Matz summed up
> the situation as follows:
>
> OK. Keyword logical operators (and, or, not) are far lower
> precedence
> than comma, even lower than method calls without argument
> parentheses
> (in parser, they are called as commands), so that they are not
> allowed
> be a part of argument expression.

Thanks, I should have checked ruby-core archives before posting.

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby...

-- Daniel


Pistos Christou

3/25/2006 10:01:00 PM

0

unknown wrote:
> OK. Keyword logical operators (and, or, not) are far lower
> precedence
> than comma, even lower than method calls without argument parentheses
> (in parser, they are called as commands), so that they are not
> allowed
> be a part of argument expression.

Is there documentation anywhere which describes when to use the English
words versus the symbols, and why? All I know is that the words have
far lower precedence, but up to this point, I have been using them in
favour of the symbols whenever possible, using parentheses to force
evaluation order.

More and more, though, I feel "discriminated against" by the language,
in that I should always be using the symbols.

Pistos

--
Posted via http://www.ruby-....


Tim Hunter

3/25/2006 10:24:00 PM

0

Pistos Christou wrote:
>
> Is there documentation anywhere which describes when to use the English
> words versus the symbols, and why? All I know is that the words have
> far lower precedence, but up to this point, I have been using them in
> favour of the symbols whenever possible, using parentheses to force
> evaluation order.
>
> More and more, though, I feel "discriminated against" by the language,
> in that I should always be using the symbols.
>
> Pistos
>

The "Expressions" section in Chapter 22 of the Pickaxe, 2nd. ed.,
contains a table of the Ruby operators in precedence order and, in the
"Boolean Expressions" section, some prose that explains the and, &&, or,
||, not and !, and defined? operators.