On Tuesday, 28 August 2018 at 01:11:14 UTC, Walter Bright wrote:
On 8/27/2018 10:08 AM, H. S. Teoh wrote:
Const in D makes sense as-is. Though, granted, its
infectiousness means
its scope is actually very narrow, and as a result, we
ironically can't
use it in very many places, and so its touted benefits only
rarely
apply. :-( Which also means that it's taking up a lot of
language
design real estate with not many benefits to show for it.
D const is of great utility if you're interested in functional
programming. Using it has forced me to rethink how I separate
tasks into functions, and the result is for the better.
I agree that D const has little utility if you try to program
in C++ style.
It doesn't play well with templates or any of the like either, so
even if you try to do template programming it is just better to
not use it.
I'm curious as to what an example of this D const for functional
programming would look like.