Which language futures make D overcompicated?

Mike Parker aldacron at gmail.com
Fri Feb 9 15:46:56 UTC 2018


On Friday, 9 February 2018 at 15:37:12 UTC, Ralph Doncaster wrote:


> I think you are proving my point.  You say there is no 
> difference between:
> const MAX_IN = 20;
> vs
> immutable MAX_IN = 20;
>
> So now I have to try both, and look at the generated code to be 
> sure.

Or read the docs:

https://dlang.org/spec/const3.html

> p.s. I prefer const since it is easier for C/C++ coders to 
> understand.  Using immutable invites the coder to go down the 
> whole rat hole of trying to understand how is it different than 
> const.

It's not a rathole. The document page above explains the 
differences rather well. They only happen to be identical when 
initialized with compile-time constants.



More information about the Digitalmars-d mailing list