About Go, D module naming

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 21 23:19:37 PST 2012


On Saturday, December 22, 2012 07:54:06 bearophile wrote:
> Jonathan M Davis:
> > And in the case of unused variables, it would completely break
> > Phobos, because so many traits legitimately use unused
> > variables.
> 
> Given how important is to spot unused variables in user code,
> then maybe some solution can be invented for library code that
> has legitimate uses of unused variables, like creating a built-in
> attribute to mark an unused variable that the compiler will not
> report as unused. Like @used, a bit like "used" function

I think that unused variables fall squarely in the realm of a lint-like tool 
and that it's serious overkill to add something to the language to mark 
variables that appear to be unused as actually being used just so that the 
compiler can complain about unused variables. But I also disagree that unused 
variables are a big deal. Certainly, I'd prefer not to have unused variables 
in my code, because it's messy to have them, but generally the worst that 
they'll do is create slight overhead because of the cost of default 
initializing them. I certainly don't think that it's worth having the compiler 
complain about them - _especially_ if that means jumping through hoops to get 
to not complain about legitimate unused variables.

- Jonathan M Davis


More information about the Digitalmars-d mailing list