Why D const is annoying

Steven Schveighoffer schveiguy at yahoo.com
Wed May 2 09:40:47 PDT 2012


On Wednesday, 2 May 2012 at 15:21:31 UTC, Mehrdad wrote:
> "Steven Schveighoffer"  wrote in message 
> news:op.wdokh6vteav7ka at localhost.localdomain...

>> But many languages that *don't* have const/immutable do well 
>> with this pattern (think Java strings).
>
> Java strings are pretty poor for performance though. :\
> You shouldn't be forced to choose between O(1) performance 
> (versus O(n)) and the correctness of your program.

This is a false choice.  The performance of Java strings (BTW, 
which I don't think is that bad) is not tied to whether they are 
immutable or not.

-Steve


More information about the Digitalmars-d mailing list