March 17, 2017 [Issue 17265] New: WithStatement: Find better Example for what "with" really does | ||||
---|---|---|---|---|
| ||||
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: nobody@puremagic.com Reporter: kdevel@vogtner.de 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. -- |
Copyright © 1999-2021 by the D Language Foundation