EOLANG and the Concept of the Purest OOP Without Types, Classes, or Loops
What if you removed classes, inheritance, static methods, and types from your favorite programming language? And along with them discarded null, operators, type casting, and control structures like if or for. It sounds crazy, but that's exactly what EOLANG (or simply EO) looks like — an experimental language created by the Objectionary team led by Yegor Bugayenko.
The project's creators are convinced that popular languages like Java, C++, Python and C# aren't actually object-oriented at all. They're hybrids where procedural code hides behind classes and utility methods. Even Smalltalk or Self, according to EO's authors, aren't pure enough.
To fix this situation, the developers decided to design a language from scratch, basing it on a formal mathematical model — $\phi$-calculus (phi-calculus).
What's Inside? Only Objects and Decoration
EO doesn't have traditional classes. Instead, it uses so-called abstract objects that come alive when arguments are passed to them. All entities are immutable by default.
You can't implement code reuse through traditional inheritance — it simply doesn't exist here. The only composition mechanism is decoration. An object contains a special attribute @ (phi) that points to another object. All calls not handled by the current object are transparently forwarded to the wrapped entity.
Here's what a simple greeting script looks like:
[args] > app
stdout > @
"Hello, world!\n"
Here app is an abstract object. It decorates the object stdout, passing it the argument "Hello, world!\n". The syntax relies on two-space indentation, somewhat reminiscent of Python, though horizontal notation via brackets is also available: stdout "Hello, world!".
But how do you write loops without while or for? In EO, loops are constructed as regular objects. Take a look at the example for printing a square table:
malloc.empty > [args] > app
seq * > [x] >>
x.put 2
while
x.as-number.lt 6 > [i] >>
seq * > [i] >>
stdout
"%d x %1$d = %d\n".printf
*
x
x.as-number.times x
x.put
x.as-number.plus 1
true
It looks unfamiliar. The code combines objects seq (sequence), while, and expressions like x.as-number.plus 1. There are no arithmetic operators + or * — instead, methods of the corresponding objects are called.
Architectural Punk: XML and XSLT 2.0 Under the Hood
The most surprising thing about the project isn't just the language's semantics, but the compiler's architecture.
Most compilers build an abstract syntax tree (AST) in memory and traverse it with visitors in Java or C++. The EO developers took a different approach. The parser converts code into XMIR — an intermediate representation based on XML.
Then the XSLT magic begins. All syntax transformations, checks, and translation to target code are implemented as a set of XSLT 2.0 stylesheets. The project's README even includes a benchmark showing how many milliseconds each .xsl file takes to process during module builds. For example, more than 30% of the time is spent on to-java.xsl.
The build pipeline is embedded directly into Apache Maven via eo-maven-plugin. Modules and third-party libraries aren't downloaded as ready-made JAR files from Maven Central. Instead, the MjPull tool pulls EO source code from Objectionary's Git repository and compiles them together with your project.
How to Try the Language Yourself?
You'll need Java SE and npm to get started. The CLI utility is installed with a single command:
npm install -g [email protected]
After that, you can compile and run a simple file:
eoc --easy link
eoc --easy --alone dataize app
Is There Any Practical Benefit to This?
It's unlikely anyone will write production services in EOLANG right now. The language remains a research experiment. It lacks conventional optimizations, and the compilation chain through XSLT performs slower than traditional solutions.
But EO serves as an excellent mental exercise. It forces you to reconsider habits formed through years of working with Java, C#, or Python. When you're stripped of null, mutability, and types, you have to relearn how to design component connectivity and use decorators.
If you're interested in programming language theory, formal models like the $\phi$-calculus, or unusual compiler architectures — the objectionary/eo repository definitely deserves your attention.
Related projects