About Go, D module naming

bearophile bearophileHUGS at lycos.com
Sat Dec 22 00:30:15 PST 2012


Jonathan M Davis:

> but generally the worst that they'll do is create slight
> overhead because of the cost of default initializing them.

I don't care about that overhead, because the optimizer stages of 
compilers take care of removing it in many cases, that's not one 
of the main points of spotting unused variables:
- Removing unused variables makes the code tidier and more clean.
- Unused variables are noise that makes harder to understand code 
and algorithms.
- And most importantly, unused variables (or assigned and never 
read) are sometimes things that the programmers has forgotten to 
initialize or use, so they are sometimes associated with bugs.


> _especially_ if that means jumping through hoops to get
> to not complain about legitimate unused variables.

Legitimate uses of unused variables are mostly in library code, 
or user code similar to library code. Adding to those variable 
definitions a @used is fast and perfectly easy. It's not a 
"jumping through hoops".

Bye,
bearophile


More information about the Digitalmars-d mailing list