DMD 1.038 and 2.022 releases
Steven Schveighoffer
schveiguy at yahoo.com
Wed Dec 17 22:01:49 PST 2008
"Simen Kjaeraas" wrote
> On Wed, 17 Dec 2008 00:39:00 +0100, Robert Jacques wrote:
>> Which I read to mean that a returned delegate is inherently pure. On a
>> second read, I think you mean that the closure heap variables may be
>> treated as immutable once a delegate is returned if the delegate doesn't
>> mutate them. While an interesting observation, it too is easily broken:
>
> Ah, I read it to mean that a delegate with no side effects is just as
> pure as a function with none, which I find hard to argue against. As D
> is a systems language, one might argue that casting a delegate to pure
> is reasonable, as it may be too hard to statically check if it is pure,
> and a cast is a confirmation from the programmer that yes, he knows
> what he's doing.
Please note, Walter's vision of pure is not the same as C's implementation
of pure.
Walter wants pure functions that have no side effects *AND* cannot be
affected by other functions' side effects. Your example fails the second
requirement.
This is more in line with actual fucntional languages, where all data is
invariant (and therefore, cannot be affected by outside functions).
-Steve
More information about the Digitalmars-d-announce
mailing list