About Go, D module naming

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 21 09:59:02 PST 2012


On Friday, December 21, 2012 18:46:20 bearophile wrote:
> Jonathan M Davis:
> > It also doesn't work with stuff like RAII and a lot of
> > conditional compilation.
> > Particularly with eponymous templates, it's _very_ common to
> > have unused
> > variables. Warnings or errors for unused variables would be
> > highly detrimental to D.
> 
> A warning for unused variables will also help D programmers avoid
> some bugs and keep their code tidy.

It doesn't work with the language - not with -w anyway. I know that you like 
the idea, but it just doesn't fly. Adding such a warning would literally change 
what code would and wouldn't compile and which branches of static ifs and 
whatnot were used. Some language features and idioms pretty much literally 
rely on the ability to have unused variables. As such, it's a horrible idea.

A lint-like tool is free to point them out for you, and maybe an IDE could 
highlight them, but actually making the compiler consider unused variables to 
be either a warning or an error would be an incredibly bad idea for D - on top 
of the fact that it would be really annoying.

- Jonathan M Davis


More information about the Digitalmars-d mailing list