About Go, D module naming
Jonathan M Davis
jmdavisProg at gmx.com
Sat Dec 22 01:04:48 PST 2012
On Saturday, December 22, 2012 09:53:48 bearophile wrote:
> Jonathan M Davis:
> > You're basically asking for a feature to be added to the
> > language so that the compiler will be able to tell you where
> > your code is messy without complaining about legitimate code,
> > _and_ your suggestion would make the legitimate code messier.
>
> Here you are right only in principle, but not in practice: in
> general legitimate uses of unused variables is not common, so the
> total amount of noise added is not large. And most of such
> legitimate uses are in library code, that is usually not seen by
> programmers.
I think that it's clear that we're just going to disagree here. Conditional
compilation has unused variables fairly often, and RAII always does. Also,
generated code can end up with unused variables in some cases and not in
others depending on how its instantiated, making having to worry about unused
variables that much worse. And I don't agree at all that those sorts of things
are uncommon.
Of course, I can't even remember the last time that I had an unused variable,
so I don't know what you're doing differently in your code that you think that
it's really a problem in the first place. Cleraly, if you run into them often,
you're doing something differently than I am.
Regardless, trying to warn about unused variables _will_ create additional
complication in the language, and I really don' think that that's the sort of
thing that the compiler should be worrying about anyway. The compiler should
be complaining about things that are unequivocably wrong, not things that
_might_ be wrong. If it were up to me, I'd remove warnings from the compiler
entirely. Walter has completely convinced me with regards to how bad an idea
compiler warnings are.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list