I hear you regarding Python.
Re: const inferrence - I have been thinking about it on and off for a while now and I think C++ has it backwards to what it should be. Consider the case when I am implementing some function and need to call foo() passing it variable bar, but don't want foo to modify it.
The way C++ offers to solve this problem is by having me first code a version of foo that swears that it does not touch its argument. So effectively I need to code foo in a way that anticipates const usage, i.e. make it forward compatible with const expectations of external code. Expectations that may or may not materialize, but yet I still need to be mindful of them. This seems excessive.
The way I would rather do it is to state that I expect foo() not to modify my variable when I'm issuing a foo call -
foo( const bar ); // note the spacious padding :)
and then let the compiler decide if this restriction can be satisfied. Note that this example assumes that
bar is a local variable. Another common case is when
bar is a given and already a const, and then I can do just this -
foo( bar );
In other words, const-ness should be a property of just variables. In a vast majority of cases deducing if a
function is const can be done automatically -- and this is what I want from my compiler.
Am I missing something? This is a complex subject, so probably I am.