Re:Why care about functional programming? Part 1: Immutability
by sirseal on Thursday March 19, 2015 @08:55PM
(#9235663)
I'm not that great at C++, but can't you use the const keyword to declare that something's value isn't changing?
[ Parent
| on HN ]
Re:Why care about functional programming? Part 1: Immutability
by tjradcliffe on Friday March 20, 2015 @01:28AM
(#9236359)
You can. If you want to write immutable C++ simply declare every single variable const. Done.
The only difference between C++ and "immutable by design" languages is that in C++ you'd have to write your own little processor to ensure that your rule is followed (this is no big deal, and I've written much more complex processors to enforce C++ coding standards as part of the build.)