Static overused? (was Re: Inner classes - More expressiveness needed)

Matti Niemenmaa see_signature at for.real.address
Thu Oct 25 10:04:05 PDT 2007


Gregor Richards wrote:
> I hate when people say that "static" is overused, when they really just
> don't know what static means.
> 
> There are only two meanings for "static" in D:
> 
>  * Static conditionals.
>  * Static declarations.
> 
> For static declarations, the meaning of static is 100% consistent. It
> means that the given declaration, though accessed by its semantic scope,
> exists in the global context. Implementation-wise, this means that it
> has no context pointer whatsoever. This is far more consistent than C,
> C++, Java, ...

Even if you count "static assert" as a conditional, there's still "static
import", which is already three completely distinct uses for one keyword. The
only other keyword with that many is "in". (One of which you might not even
count, as it's obvious to anybody without programming experience what "a in b"
means. With "static", none of the meanings are as obvious.)

As far as I can come up with, "out", "scope", and "void" have two distinct
meanings, and the rest have one.

So, despite knowing what "static" means, I'd say it's the most used keyword in
the language, and overused.

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list