Re:Why Const Sucks
by gorgonical on Tuesday March 06, 2018 @01:16AM
(#16527225)
I agree. Even extremely safe languages like Ada, which have found most of their use in safety-critical situations like in plane avionics and medical equipment, allow the programmer to do "unchecked conversions," the equivalent of a static_cast.
It would actually be insane for const to forbid the programmer from doing any of these things. A certain amount of a language and its features is to protect your program from other programmers, to communicate your idea and vision about the code. In that way, const is amazingly useful.
> A certain amount of a language and its features is to protect your program from other programmers, to communicate your idea and vision about the code.
indeed ! language is about telling others (and yourself) about ideas that you want to express. c and c++ seems to be more suited for 'consenting adults' (oh dear) than anything else :)
if this is the only reason why author thinks that const is a problem, then it is all good. you can do the same thing in C as well. and ofcourse, if you do that, and break things, you get to hold all the pieces as well :)
probably a 'constexpr' semantics is what the author might be looking for ?
arne-mertz article on mutable, available here: https://arne-mertz.de/2017/10/mutable/, which imho, is another side of the const-coin, is quite good as well.
edit-001 : slight change.