Memory allocation purity
via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 19 09:58:04 PDT 2014
On Monday, 19 May 2014 at 08:51:11 UTC, Jonathan M Davis via
Digitalmars-d wrote:
> Perhaps you're hung up on the fact
> that the term "pure" is being used, and you're thinking about
> functional
> purity?
No, I just don't think it makes much sense the way "pure" is
defined in D. Since it doesn't actually mean anything specific
unless you also do analysis of the parameters and return type.
If you put a restriction on a function then that restriction
should be well defined, clear and useful for a specific purpose.
> stuck with it at this point. Regardless, the fact that D's pure
> allows us to
> determine when the return value of a function has to be unique
But it doesn't declare a return value to be unique… It just
states that there are no side effects except through the
arguments, and except for object identity. I am also not sure if
it makes much sense to make it mandatory to define a function in
order to initialize an immutable value in an imperative language.
I don't like the orthogonal aspect of blocks and functions.
Imperative functions and procedures are essentially named blocks
of statements. Pure functions are essentially expressions.
More information about the Digitalmars-d
mailing list