digitalmars.D - bug in purity validation
- Timon Gehr (12/12) Jun 05 2011 From bearophile's ported benchmark:
- Timon Gehr (3/15) Jun 05 2011 Ah, the implicit "this" parameter...
- Stewart Gordon (4/5) Jun 11 2011 What's that to do with anything?
- Timon Gehr (5/10) Jun 11 2011 I weakly pure function may modify any memory location reachable by its (...
From bearophile's ported benchmark: // Getters/Setters pure nothrow SimpleLoop* parent() { return parent_; } //... pure nothrow void setParent(SimpleLoop* parent) { parent_ = parent; parent.addChildLoop(&this); } //... SimpleLoop* parent_; Why does that compile? There is no way those functions can be pure. Timon
Jun 05 2011
Timon Gehr wrote:From bearophile's ported benchmark: // Getters/Setters pure nothrow SimpleLoop* parent() { return parent_; } //... pure nothrow void setParent(SimpleLoop* parent) { parent_ = parent; parent.addChildLoop(&this); } //... SimpleLoop* parent_; Why does that compile? There is no way those functions can be pure. TimonAh, the implicit "this" parameter... Timon
Jun 05 2011
On 05/06/2011 11:10, Timon Gehr wrote: <snip>Ah, the implicit "this" parameter...What's that to do with anything? Stewart.
Jun 11 2011
Stewart Gordon wrote:On 05/06/2011 11:10, Timon Gehr wrote: <snip>I weakly pure function may modify any memory location reachable by its (mutable) parameters. What I didn't realize at first and late in the night is that obviously this also applies to the implicit 'this' parameter. TimonAh, the implicit "this" parameter...What's that to do with anything? Stewart.
Jun 11 2011