Bug 9105 – alias to refer to instance.attribute

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-02T11:27:00Z
Last change time
2012-12-02T11:29:39Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-12-02T11:27:16Z
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.
Comment #1 by andrej.mitrovich — 2012-12-02T11:29:39Z
*** This issue has been marked as a duplicate of issue 6842 ***