thoughts on immutability in D

Steven Schveighoffer schveiguy at yahoo.com
Mon Sep 26 07:28:46 PDT 2011


On Fri, 23 Sep 2011 20:05:16 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 9/23/2011 3:46 PM, Peter Alexander 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.
>
> You can define an object with private only access to its data members,  
> and do logical const that way without needing faith.

const functions still require faith that nobody used a global.

-Steve


More information about the Digitalmars-d mailing list