Robert Virding rv@REDACTED
Mon Apr 9 02:01:59 CEST 2001

Chris Pressey <cpressey@REDACTED> writes:
>Perhaps some future version of the compiler could warn against unused
>variable bindings?  This is a feature that is in Perl, but I find it
>somewhat annoying to me there (as it does not match my
>imperative/procedural programming style, where mutable variables can be
>updated arbitrarily anyway.)
>But in Erlang is would actually make a lot more sense and I think I
>would like it a lot.

This already exists.  If you give the option 'warn_unused_vars' to the
compiler it will list all variables that are never used EXCEPT those
whose name starts with "_", e.g. _Foo or _bar.  The rationale behind
this is that it gives you a way of using meaningful names instead of
"_" for variables you neve use.

I personally don't like this option as it does not suit my style of
using variable names.  For an example of what can happen with code not
tuned to this option recompile erl_lint.erl.

Some other useful checking options are 'warn_unused_imports' and
'warn_format' for checking imports and calls to io:fwrite/format.  The
last can also take different values {warn_format,0-3} where 3 checks
the most.

Robert Virding                          Tel: +46 (0)8 692 22 12
Bluetail AB                             Email: rv@REDACTED
Hantverkargatan 78                      WWW:
SE-112 38 Stockholm, SWEDEN
"Folk säger att jag inte bryr mig om någonting, men det skiter jag i".

More information about the erlang-questions mailing list