Purity

spir denis.spir at gmail.com
Sat Dec 18 00:52:23 PST 2010


On Fri, 17 Dec 2010 02:42:14 -0500
bearophile <bearophileHUGS at lycos.com> wrote:

> http://www.reddit.com/r/programming/comments/enajl/purity_in_d_language/
> 
> Bye,
> bearophile

I take the opportunity to question the def of weakly pure.

-1- How can this even compile?
	pure append (ref int[] a, int i) {a ~= i;}
The _only_ task of this func is to change state.

-2- Why is output writing considered an impure task? It has no influence on the rest/future of the program, lets reasoning easy, does not touch state.

I would like weakly pure to include output funcs, and exclude all possibilities to modify (non-local) state.


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list