From: Pixel Date: 2001-10-27T04:20:53+09:00 Subject: [ruby-talk:23494] Re: Issues with white space [was Re: Bruce Eckel's opinion of Ruby] Paul Brannan writes: > On Sat, 27 Oct 2001, Pixel wrote: > > > I think the easiest way to catch this is to warn for unused constants alike > > C's compiler: > > > > % echo 'int main() { 1 ; return 0; }' > /tmp/t.c && gcc -Wall /tmp/t.c > > /tmp/t.c:1: warning: statement with no effect > > This is not as easy as it sounds: > > 1 + 1 # statement has no effect well, starting with constants could catch some errors... of course, i = ((1+1 +1) / 2) will not be detected, but at least catching easy case is a good starting point. [...] > Perhaps Ruby should have different warning levels? I like this, i heard of a python checker. As for me, i use a simple script[1] for catching common errors in perl, eg: never use ``length @l'', it returns the length of the string int(@l) never use ``local $var ||= '', write ``local $var = $var || '' cond ? $v1 = XX1 : $v2 = XX2'' which is parted as ``(cond ? $v1 = XX1 : $v2) = XX2'' [1] http://www.mandrakelinux.com/cgi-bin/cvsweb.cgi/~checkout~/soft/perl-MDK-Common/perl_checker?rev=1