Poll: Would you like to try const-by-default or not?

Robert Fraser fraserofthenight at gmail.com
Mon Jun 11 12:24:08 PDT 2007


I'm rather against the whole constness concept in general, but I think by default would be a lot easier than trying to think through whether I've changed something or not. So, while I used to think the first would be better, you've all convinced me -- option 2. If it doesn't work out in the alpha, it doesn't work out in the alpha, and we switch back.

Here's another option I'm sure has been mentioned: what about a compiler switch for default "in" vs. default "var" (I agree that "mutable" is way too long to type all the time)?

Jarrett Billingsley Wrote:

> This is not a discussion thread.  I think we've discussed enough.  :)
> 
> Basically there are these possible const implementations (there are others, 
> but for the sake of simplicitly, I'll keep this poll to 2):
> 
> 1) C++ style const, where you mark anything that should be const as such.
> 
> 2) Parameters are const-by-default, and must be marked mutable otherwise. 
> Locals, fields etc. are still mutable by default.
> 
> Walter doesn't want to stray from option 1, because 2 is basically "too 
> weird."
> 
> Please reply with your choice, and maybe a small explanation of why.
> 
> I'll start this off by saying I'm definitely willing to try option 2.  I 
> never really learned const-correctness in C++ because it looked so damned 
> awful.  Option 2 makes more sense to me. 
> 
> 




More information about the Digitalmars-d mailing list