[Issue 10150] New: Prefix method 'this' qualifiers should be just ignored anytime

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 23 06:23:12 PDT 2013


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

           Summary: Prefix method 'this' qualifiers should be just ignored
                    anytime
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-05-23 06:23:11 PDT ---
By fixing issue 9199, git head rejects all meaningless method qualifiers for
non-method functions.

class C1
{
    const     static void fc() {}   // NG in both 2.062 and git head
    immutable static void fi() {}   // NG in both 2.062 and git head
    shared    static void fs() {}   // OK in 2.063 but NG in git head
    inout     static void fw() {}   // OK in 2.063 but NG in git head
}

class C2
{
    static void fc() const     {}   // NG in both 2.062 and git head
    static void fi() immutable {}   // NG in both 2.062 and git head
    static void fs() shared    {}   // OK in 2.063 but NG in git head
    static void fw() inout     {}   // OK in 2.063 but NG in git head
}

const     void fc1() {}     // NG in both 2.062 and git head
immutable void fi1() {}     // NG in both 2.062 and git head
shared    void fs1() {}     // OK in 2.063 but NG in git head
inout     void fw1() {}     // OK in 2.063 but NG in git head

void fc2() const     {}     // NG in both 2.062 and git head
void fi2() immutable {}     // NG in both 2.062 and git head
void fs2() shared    {}     // OK in 2.063 but NG in git head
void fw2() inout     {}     // OK in 2.063 but NG in git head

---

But this behavior is restrictive and now breaking exist code. Dlanguage allows
to rewrite prefix storage class to label syntax and scope syntax.

const void foo() {}      // previous
const: void foo() {}     // label
const { void foo() {} }  // scope

Making errors for the functions enclosed by attribute would be inconvenient.
So, I'd like to propose that:

1. Module level functions and class/struct scope static functions just ignore
prefix method 'this' qualifiers (const, immutable, shared, and inout).
2. But specifying them at postfix position should be rejected.

The rule is consistent and make writing code more handy.

-- 
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