what is the difference between static method of the class, module method and static method of the module?

Timon Gehr timon.gehr at gmx.ch
Wed Jun 20 14:44:27 PDT 2012


On 06/20/2012 09:52 PM, bearophile wrote:
> Alex Rønne Petersen:
>
>> The static keyword has no effect on module functions, so 2 and 3 are
>> equivalent.
>
> This problem is caused by DMD sloppyness regarding its management of
> attributes. A serious language  doesn't accept a keyword like "static"
> where it has no meaning.

What is a 'serious language'?

interface I{ static int x=2; } // java

> It just causes confusion to newbies, and makes
> it harder to port D code across future D compilers...
>
> Bye,
> bearophile

To be fair, it does not have no meaning. It is simply redundant, because 
all module scope declarations are implicitly 'static'.


More information about the Digitalmars-d-learn mailing list