On Wednesday, 28 May 2014 at 18:08:42 UTC, Walter Bright wrote:
On 5/28/2014 1:49 AM, Russel Winder via Digitalmars-d wrote:
Also, D's approach does not support lazy evaluation, caches of
all sorts
etc, that we think are crucial in application software.
Yes, that's so-called "logical const". This has come up several
times here, and many have argued strongly to support it.
My view is that logical const is not mechanically checkable,
and therefore is a convention. D's const'ness is about
guarantees, not conventions.
Of course, D offers an escape from anything. You can do logical
constness by using unsafe casts, but the onus is then on you to
get it right.
I'm a big fan of D's const, and strong static checking is one of
the reasons I picked up D a while ago. I think putting a little
violation of the type system to accomplish something you really,
really need, say in a @trusted function, is a good way to do
things. Most of the time, you don't *really* need to do those
things.