July 29, 2011 [Issue 6400] New: opDispatch with WithStatement | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6400 Summary: opDispatch with WithStatement Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: zan77137@nifty.com --- Comment #0 from SHOO <zan77137@nifty.com> 2011-07-29 08:31:01 PDT --- Following code doesn't work: ---------------------------- import std.stdio; class Foo { void opDispatch(string name)() { writeln(name); } } void main() { auto foo = new Foo; with (foo) { bar(); } } ---------------------------- Result: $ dmd -run main main.d(16): Error: undefined identifier bar ---------------------------- According to the specifications, WithStatement should be interpreted as follows: ---- with (foo) { bar(); } ---- is semantically equivalent to: Foo tmp = foo; tmp.bar(); ---- is semantically equivalent to: Foo tmp = foo; tmp.opDispatch!("bar")(); ---- It is incorrect behavior and is a bug. And another thing, this syntax is simply convenient if I could use opDispatch in WithStatement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 26, 2012 [Issue 6400] opDispatch with WithStatement | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | http://d.puremagic.com/issues/show_bug.cgi?id=6400 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear@mailmetrash.com --- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-26 09:50:39 PDT --- Not working on 2.059 -- 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