www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9105] New: alias to refer to instance.attribute

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Dec 02 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9105


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |DUPLICATE



11:29:39 PST ---
*** This issue has been marked as a duplicate of issue 6842 ***

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