A purity change

Meta jared771 at gmail.com
Thu Jul 11 09:31:13 PDT 2013


On Thursday, 11 July 2013 at 16:14:13 UTC, H. S. Teoh wrote:
> On Thu, Jul 11, 2013 at 05:25:09PM +0200, bearophile wrote:
> Hmm. This seems to be a tricky corner case. The delegate itself 
> is impure, as it accesses y which is outside of its definition 
> and isn't part of its arguments; however, in the larger context 
> of spam(), this shouldn't be a problem since y is accessed via 
> 'this', and 'this' is part of spam's input.

Isn't it okay for pure functions to access global immutable 
state, such as what the delegate is doing here?


More information about the Digitalmars-d-learn mailing list