https://issues.dlang.org/show_bug.cgi?id=17265
Issue ID: 17265
Summary: WithStatement: Find better Example for what "with"
really does
Product: D
Version: D2
Hardware: Other
OS: Other
Status: NEW
Severity: enhancement
Priority: P1
Component: dlang.org
Assignee: [email protected]
Reporter: [email protected]
The documentation
http://dlang.org/spec/statement.html#WithStatement
claims an equivalence of
with (expression)
{
...
ident;
}
and
{
Object tmp;
tmp = expression;
...
tmp.ident;
}
This does not hold if "Object" refers to a struct type. While the former
invokes ident on the original object (struct), the latter invokes it on a copy.
Hence there is no equivalence.
--