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

E

Eero Saynatkari

--xtx0sNU5lZ46KfgK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello!=20

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"=20
=20
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. =20

--xtx0sNU5lZ46KfgK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFHgiU7Nh7RM4TrhIRAmIJAKCqufMSgK/lusthgdBTrSQ9OQexxwCfYOy2
TEBL0NKsw+qvc63HqEe/04Y=
=PHOe
-----END PGP SIGNATURE-----

--xtx0sNU5lZ46KfgK--
 
R

Robert Klemme

Eero said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

nil.to_s != "nil" 11
ruby 1.8.3 on windows 2
receive timeout on socket 0
[ANN] keybox 1.1.1 Released 0
RDoc vs metaprogramming 6
gem "before" and "after" filters? 1
alarm? 4
using common layout in Rails 3

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top