archives

Fully Encapsulated Languages? Are there any out there?

One thought is obsessing my programming language design thinking at the moment...

Bjarne Stroustrup's maxim that you should only consider creating a class if you have a class invariant to protect.

Does there exist a language,
where the internal state of an object instance can be so fully encapsulated,
that there is no way for anything other than an method of that instance,
to modify that state,
so the instance's invariant was violated?

And if not, what would such a language look like?

C++ is clearly not such a language as pointers and casts and references to internal state abound.

I expect it to be a Linear Logic language, as two objects of different class sharing the some of same internal state could trivially violate this rule.