In the example with MutableVal the inst var cannot be changed at all. The D programming language has true immutable types, see Type Qualifiers - D Programming Language.
Let’s have a look at some sample code using the immutable keyword in D:
immutable(char)[] s = "hello";
s[0] = 'b'; // error, s[] is immutable
class Foo
{
public int bar;
}
Foo foo = new Foo();
foo.bar = 67; // compiles fine
immutable Foo foo = new Foo();
foo.bar = 67; // compiler error, everything inside foo is immutable as well
Note that the variable bar in Foo is not declared immutable inside class Foo. So it can be mutable or immutable which is decided at the time the variable is declared to hold an instance of class Foo.
This can neither be done in Kotlin nor Scala. If I remember right there was a discussion about having this in Kotlin, but the request was declined. Think the reason was that there is no support for that kind of thing in the JVM and adding such a feature on byte code level would cause too much bloat of byte code, making the compiler slow, etc. So for practical reasons not really doable on the JVM.