pure-ifying my code
Jonathan M Davis
jmdavisProg at gmx.com
Sun Nov 17 03:00:08 PST 2013
On Sunday, November 17, 2013 11:53:57 David Nadlinger wrote:
> On Sunday, 17 November 2013 at 10:33:12 UTC, Philippe Sigaud
>
> wrote:
> > But `popFront()` changes an internal state with visible,
> > external
> > effects: it changes `front` return value and in the end, it will
> > affect `empty` return value.
> > So no, I don't consider `popFront` to be pure.
>
> That's actually not a reason for them to be impure (see e.g.
> http://klickverbot.at/blog/2012/05/purity-in-d#pure_member_functions
> for my attempt on explaining that).
I should put that on my list of articles to link people to. I'd forgotten
about it.
For that matter, I should probably write more articles like that myself so
that I can point people to them instead of explaining the same thing over and
over again.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list