Getting the const-correctness of Object sorted once and for all

Mehrdad wfunction at hotmail.com
Sun May 13 23:09:14 PDT 2012


On Monday, 14 May 2012 at 04:10:30 UTC, Chris Cain wrote:
> Let me ask you something: Could you try to name 2 or 3 good 
> things about const/immutable without looking it up? If not, 
> you've really not given enough effort to learning about the 
> benefits of it.


(1) Compiler helps you write correct multithreaded code
(2) You help compiler perform optimizations based on contracts
(3) I don't think there exists a #3 that's very different from #1 
and #2




I'm not saying const is bad (at least, that's not what I'm saying 
*here*).

What I'm saying is that it's being forced upon the user, and it's 
becoming unavoidable. Which means people who don't like it won't 
use D.

Kind of like the GC.


More information about the Digitalmars-d mailing list