thoughts on immutability in D

Peter Alexander peter.alexander.au at gmail.com
Sat Sep 24 06:03:00 PDT 2011


On 23/09/11 11:58 PM, Andrej Mitrovic wrote:
> On 9/24/11, Peter Alexander<peter.alexander.au at gmail.com>  wrote:
>> On 23/09/11 6:48 AM, Walter Bright wrote:
>>> On 9/22/2011 4:39 AM, bearophile wrote:
>>>> Walter:
>>> "logical const" in C++ is faith-based programming.
>>
>> I think you're exaggerating it's uselessness.
>>
>> It's faith-based as much as 'walking down the street assuming that the
>> next person won't stab you' is faith-based. There's no guarantee, but
>> 99% of the time your "faith" is well placed.
>>
>
> So then don't use const if u need caching and use convention if your
> faith is well placed!

That's what I do :-)

I only use const/immutable for concurrency. Nothing else.


More information about the Digitalmars-d mailing list