[Issue 4407] New: Catch wrong argument<->attribute assignments in methods
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 29 18:15:57 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4407
Summary: Catch wrong argument<->attribute assignments in
methods
Product: D
Version: D1 & D2
Platform: All
OS/Version: All
Status: NEW
Keywords: diagnostic
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 2010-06-29 18:15:53 PDT ---
This is related to bug 3878 , but it is meant to catch a different kind of bug.
In my code I have seen two times bugs like:
class Foo {
int x, y;
this(int x_, int y_) {
this.x = x;
y = y;
}
}
void main() {}
In D.learn Byron Heads has found this bug:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=20354
this(string name, string id) {
this._name = _name;
this._id = id;
}
So I think the D compiler has to catch such bugs, and refuse such assignments
in class/struct member functions.
Automatic code generation can sometimes generate useless assignments, but
catching common human bugs is more important. It's much simpler to fix code
generators than humans.
--
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