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

gareis dhasenan at gmail.com
Sun Jun 10 14:11:37 PDT 2007


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.

Doubt it makes much difference, but I prefer having function arguments 
be scope final const by default. Instead of seeing 'in' on a function 
signature and knowing I'm safe calling it with my precious data, I know 
that my data's safe unless I'm explicitly told otherwise.

Though T[new] is a different story entirely.



More information about the Digitalmars-d mailing list