Static function at module level
Phil Lavoie via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 18 10:55:01 PDT 2014
On Monday, 18 August 2014 at 17:42:37 UTC, ketmar via
Digitalmars-d-learn wrote:
> On Mon, 18 Aug 2014 06:46:02 +0000
> bearophile via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com>
> wrote:
>
>> accepting useless code confuses newbies
> i think that i'm not really a newbie now ;-), but i'm still
> used to
> declare various private module functions and variables as
> 'static'.
> yes, sometimes this confuses me (as to "do i need to make this
> sta...
> ah, scrap that, it's D!"), but sometimes this is handy. why?
> i'm still
> have to use C sometimes, and i'm writing 'static'
> automatically. having
> compiler to accept it for anything high-level saves me one
> regexp
> search-and-replace. ;-)
I don't think he meant you personally. Well, I hope not. I was
confused by it too and I don't consider myself a D newbie.
I get that it is convenient for you. I have done a lot of C
myself. However, convenience loses to misleading in my book.
Consider that in the future, for example, "static interface
Toto{}" means something different than "interface Toto{}". I am
not debating whether or not that would ever happen or what would
even be the meaning of a static interface (even though I have an
idea), the point is more like this: every compiler version will
accept both versions of said interface, but some of those
compiler will interpret it differently. Now that's a problem.
Philz
More information about the Digitalmars-d-learn
mailing list