digitalmars.D.bugs - [Issue 7521] New: Add const inference for templated method and delegate parameters
- d-bugmail puremagic.com (36/36) Feb 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7521
- d-bugmail puremagic.com (19/19) Feb 16 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7521
- d-bugmail puremagic.com (6/6) Feb 25 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7521
http://d.puremagic.com/issues/show_bug.cgi?id=7521 Summary: Add const inference for templated method and delegate parameters Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timon.gehr gmx.ch --- Comment #0 from timon.gehr gmx.ch 2012-02-16 07:50:25 PST --- Not only pure/nothrow/ safe should be inferred, but const on parameters and methods should be inferred too. This increases the expressiveness of alias parameters and is required for making templates const correct. Inferring const for delegate parameters reduces the annotation overhead and makes treatment of template delegate literals uniform with normal delegate literals. IOW, the following code should compile: int glob; class Foo(alias a){ int x; void foo(){a(this);} static int bar(Foo x){return a(foo);} } void main(){ alias Foo!((p){glob=p.x;}) T; // parameter p inferred const auto foo = new immutable(T); foo.foo(); // OK, T.foo inferred const T.bar(foo); // OK, parameter x of T.bar inferred const (T x){glob = x.x;}(foo); // OK, parameter x inferred const } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7521 --- Comment #1 from timon.gehr gmx.ch 2012-02-16 07:59:35 PST --- The original example contained some mistakes, second try: int glob; class Foo(alias a){ int x; void foo(){a(this);} static void bar(Foo x){a(x);} } void main(){ alias Foo!((a){glob=a.x;}) T; // parameter a inferred const auto foo = new immutable(T); foo.foo(); // OK, foo inferred const T.bar(foo); // OK, parameter x inferred const (T x){glob = x.x;}(foo); // ok, parameter x inferred const } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 16 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7521 --- Comment #2 from timon.gehr gmx.ch 2012-02-25 07:06:34 PST --- This probably shouldn't be done for virtual functions of templated classes. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 25 2012