`@safe` by default. What about `@pure` and `immutable` by default?
Adam D. Ruppe
destructionator at gmail.com
Tue Apr 16 13:25:21 UTC 2019
On Tuesday, 16 April 2019 at 03:59:38 UTC, Mike Franklin wrote:
> `@safe` by default is a no-brainer in my opinion, but `pure`
> and `immutable` by default are less obvious.
I think pure should be too (and actually, even nothrow maybe),
but not immutable.
With pure, you won't even actually notice it with the majority of
functions... and if you do notice it, you can mostly just change
a global to a function argument and solve it, which tends to be
cleaner design anyway.
Though, one surprising problem with pure is that floating point
functions don't count! We need to think up some solution to that.
immutable though is really a completely different paradigm. It is
very invasive, there's no escape hatch (like with nothrow, you
can put try/catch on to limit its influence, immutable has no way
to get out), and I'd be surprised if any existing D code would
work with that change; you'd definitely notice it.
We brag about having pure and mutable together, I like having
that.
More information about the Digitalmars-d
mailing list