const as default for variables

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 14 22:23:35 PDT 2015


On Sunday, 15 March 2015 at 05:08:54 UTC, Walter Bright wrote:
> On 3/14/2015 8:50 PM, deadalnix wrote:
>> Const is the inconvenience of immutability without its 
>> benefit. That would be a
>> poor default, IMO.
>
> It's utility is in self-documenting encapsulation.
>
> It also turns out that it offers optimization possibilities for 
> ARC systems.

You'll have to explain yourself, as there is nothing obvious here.

I see how immutable can be leveraged to optimize, but I don't 
think const offers the same capabilities.


More information about the Digitalmars-d mailing list