There's also the problem of internal mutation of state, with hashtables/collections being again primary examples. It's not always avoidable to have internal mutation, but it shouldn't be the default, in most cases it's just wrong.
There's also the problem of internal mutation of state, with hashtables/collections being again primary examples. It's not always avoidable to have internal mutation, but it shouldn't be the default, in most cases it's just wrong.
What else are you going to do? If you want to insert a value but also have access to the hashtable without the change, then you need to copy it. (Or use a data structure with history tracking, like RCU or finger trees.)
If you don't need the old value, then you can optimize out the copy - this isn't too hard.
Why do you even bother with static types if you seriously believe that?
procedure Foo(constref Something: SomeType);
instead of procedure Foo(var Something: SomeType);
in Free Pascal? Both will pass the same stuff in memory (stack), but one has different semantics.Similarly
const NiceFeature = $01; NeatFeature = $02; GoodFeature = $04;
var Features: Byte;
and {$packset 1}
type Feature = (Nice, Neat, Good);
var Features: set of Feature;
would be stored the same way in memory but again, different semantics with the compiler helping you in the second case to avoid logic bugs (e.g. setting Features to an invalid value).These are cases where Free Pascal helps you from shooting yourself in the foot.
I can see the value of making sure you don't end up with invalid values.
And "weird corner case"? Really?