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.

Most powerful terminating semantics?

I was curious if there was any sort of consensus for what the most powerful semantics known so far that are still guaranteed to only allow one to write programs that terminate? Phrased another way, languages that are "as close as possible to being Turing complete without actually being Turing complete." Most powerful in this context meaning something like, "the language for which their exists a function mapping all possible programs written in it to equivalent programs in the domain of all-possible-programs-that-could-be-written-in-a-Turing-complete-language with the largest image compared to all other such functions for other languages".