A purity change

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jul 11 09:51:54 PDT 2013


On Thu, Jul 11, 2013 at 06:31:13PM +0200, Meta wrote:
> 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?

True, I didn't think of that. :) So in this case it looks like a
regression.


T

-- 
Mediocrity has been pushed to extremes.


More information about the Digitalmars-d-learn mailing list