Would you like to try const-by-default or not?
Rioshin an'Harthen
rharth75 at hotmail.com
Mon Jun 11 02:39:39 PDT 2007
"Jarrett Billingsley" <kb3ctd2 at yahoo.com> kirjoitti viestissä
news:f4h2s9$qm8$1 at digitalmars.com...
> 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'd definitely go for option 2 - having had to code const correct C++, I
know
what kind of a pain it is. Much simpler to have every parameter be const by
default and add mutable/variant etc. in front of those the compiler
complains
about. Voila! Automatically const correct code.
More information about the Digitalmars-d
mailing list