`@safe` by default. What about `@pure` and `immutable` by default?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Apr 18 18:56:30 UTC 2019


On Thu, Apr 18, 2019 at 06:33:33PM +0000, Eugene Wissner via Digitalmars-d wrote:
[...]
> Thinking of the last discussion about pure, just before pureMalloc was
> introduced, I got a different feeling, but well, it kind of does, what
> the specification says.
> 
> I also don't find Haskell's purity "insane", but actually very useful
> and solid, so I might be biased torwards "strong purity" or "no purity
> at all".
[...]

It may help to understand the historical context in which D's purity,
particularly "weak purity", arose. What D calls "strong purity" is
equivalent to Haskell's purity, and was the original definition of
'pure' in D.  What we call today "weak purity" came as a relaxation of
strong purity in order to increase the scope of 'pure's applicability,
and by so doing, increase the amount of code that can be made strongly
pure.  More details in this article:

	http://klickverbot.at/blog/2012/05/purity-in-d/


T

-- 
Never trust an operating system you don't have source for! -- Martin Schulze


More information about the Digitalmars-d mailing list