Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 16, 2012 [Issue 8669] New: TemplateThisParameter should change member function's qualifier | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8669 Summary: TemplateThisParameter should change member function's qualifier Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-16 07:49:19 PDT --- With current implementation, a member function with TemplateThisParameter is not generated based on each 'this' type. struct X { void foo(this T)() {} } void main() { X mx; mx.foo(); // T == X, and foo is mutable member function. // then we can call it with mutable object. immutable(X) ix; ix.foo(); // T == immutable(X), but foo is still *mutable* member function. // then we cannot call it with immutable object } foo is always instantiated as mutable member function, and always cannot be called with non-mutable object. I think this is not convenient in many cases. ==== Enhancement: If foo is called from immutable object, foo should be instantiated as immutable member function. Following is detailed explanation of compiler behavior to realize it. The declaration of foo is expanded as like follows. struct X { template foo(this T) { void foo() {} } } If T is immutable type, compiler would wrap the template body into StorageClassDeclaration. struct X { template foo(this T) { // if T == immutable immutable{ // <-- automatically wrapped by the compiler void foo() {} // now foo is immutable member function } } template foo(this T) { // if T == const const{ // <-- automatically wrapped by the compiler void foo() {} // now foo is const member function } } // as well, if T == shared, shared const, inout, and shared inout } This would make forwarding operations more convenient, e.g. std.typecons.Proxy. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 16, 2012 [Issue 8669] TemplateThisParameter should change member function's qualifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8669 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-09-16 08:26:21 PDT --- https://github.com/D-Programming-Language/dmd/pull/1121 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 06, 2013 [Issue 8669] TemplateThisParameter should change member function's qualifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8669 --- Comment #2 from github-bugzilla@puremagic.com 2013-03-06 09:56:00 PST --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/31e57cd1e1606d156f2117c5bef4701005438fba fix Issue 8669 - TemplateThisParameter should change member function's qualifier https://github.com/D-Programming-Language/dmd/commit/391addfda30738089ca220f0d9f025e3842deb1f Merge pull request #1121 from 9rnsr/fix8669 [enh] Issue 8669 - TemplateThisParameter should change member function's qualifier -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 06, 2013 [Issue 8669] TemplateThisParameter should change member function's qualifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8669 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 12, 2013 [Issue 8669] TemplateThisParameter should change member function's qualifier | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8669 --- Comment #3 from github-bugzilla@puremagic.com 2013-03-11 22:06:12 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0879a5ea45c08463b3a408f7e29e48ec8312be5b Improve test cases for qualified objects By fixing issue 8669, they are now working properly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation