[Issue 6579] Calling static method should *require* using type and not instance, unless specified by author

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 4 09:59:18 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6579



--- Comment #8 from Steven Schveighoffer <schveiguy at yahoo.com> 2012-06-04 10:01:16 PDT ---
(In reply to comment #7)

> Oh, and i just noticed the suggestion in this report that static fields should
> not be accessible via an instance - no, that would a break a lot of code, for
> almost no gain (you can already place the static data in another struct and
> embed
> that one in an (anonymous) union)

That is not as important as the method calls.  At least with instance access to
static data, you are addressing the data named by the call.

So for my original example:

instance.i = 5;

This is correctly addressing a variable named i, even though it's not part of
the instance.

However, with:

instance.reset();

This implies you are passing instance as a parameter when you are actually not.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list