[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

On #<, #> and -w (void context warnings

Eero Saynatkari

9/30/2006 6:05:00 AM

Hello!

Time for the weekly syntax analysis thingy. ruby -w causes
this code to issue a warning:

# warning: useless use of < in void context
'/tmp/foo' < "Some text here"

Same goes for #>. The problem, somewhat obviously, goes away
when the same expression is used in a conditional position.

I was thinking about it and there is really no way to avoid
this assuming that the warning is considered to be useful
for those instances where someone accidentally uses this
type of an expression outside a conditional.
1 Answer

Robert Klemme

9/30/2006 8:46:00 AM

0

Eero Saynatkari wrote:
> Hello!
>
> Time for the weekly syntax analysis thingy. ruby -w causes
> this code to issue a warning:
>
> # warning: useless use of < in void context
> '/tmp/foo' < "Some text here"
>
> Same goes for #>. The problem, somewhat obviously, goes away
> when the same expression is used in a conditional position.
>
> I was thinking about it and there is really no way to avoid
> this assuming that the warning is considered to be useful
> for those instances where someone accidentally uses this
> type of an expression outside a conditional.

This is a quite accurate summary.

Kind regards

robert