[Issue 9105] New: alias to refer to instance.attribute

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 2 11:27:17 PST 2012


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

           Summary: alias to refer to instance.attribute
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-12-02 11:27:16 PST ---
Sometimes it's handy to use alias to shorten a instance.attribute name that's
used often in some code:


struct Foo { int x; }
void main() {
    Foo f;
    alias fd = f.x;
    fd = 1;
}


DMD 2.061alpha:

test2.d(5): Error: need 'this' to access member x


This is an enhancement request, but also that error message doesn't seem good.

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