What is pure and what is not pure
Fawzi Mohamed
fmohamed at mac.com
Fri Apr 4 03:08:03 PDT 2008
I think that your pot is very well done, and from it it is also clear
why for pure functions something like the transitive invariant is
needed: the pure function should not be able to see changes in its
arguments, otherwise it is not anymore pure.
And purity is not just nice for the compiler optimizations, but also
because it makes testing easier, and it guarantees the absence of
indeterminism, something that when one programs in parallel is *very*
nice to have.
As I pointed out in my earlier post (where I was such a newbie the I
even mispelled newbie...) I think that const is a nice thing, and
actually to have purity, one can relax the const by allowing suspended
of still undefined values (if done in the correct way), and then one
whould also have laziness.
These extension can be added later on the top of const and in a very
controlled way by just having two new types of const pointers (that
would be given by the language) that implement it.
More information about the Digitalmars-d
mailing list