digitalmars.D.bugs - [Issue 6400] New: opDispatch with WithStatement
- d-bugmail puremagic.com (55/55) Jul 29 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6400
- d-bugmail puremagic.com (10/10) Apr 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6400
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
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: -------
Jul 29 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6400
SomeDude <lovelydear mailmetrash.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lovelydear mailmetrash.com
PDT ---
Not working on 2.059
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 26 2012








d-bugmail puremagic.com