Summary: Calling static method should *require* using type and
                    not instance
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from Steven Schveighoffer <> 2011-08-30 
05:33:42 PDT ---

struct S
   static int i;
   int x;
   static void reset() {i = i.init;}

S instance;
assert(instance.x == 0);
instance.x = 5;


assert(instance.x == 0); // fails!

This appears to affect instance, but actually it does nothing to the instance,
it only affects the static data.

I think it should require using the type, via:




This makes it clear that the instance plays no role in the function call.

This also paves the way for bug 3345

I think also this should apply to member fields.  However, enums and aliases
should continue to be accessible using the instance.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to