Reducing Programs to Objects

Yegor Bugayenko
2023-10-27
Abstract:C++, Java, C#, Python, Ruby, JavaScript are the most powerful object-oriented programming languages, if language power would be defined as the number of features available for a programmer. EO, on the other hand, is an object-oriented programming language with a reduced set of features: it has nothing by objects and mechanisms of their composition and decoration. We are trying to answer the following research question: "Which known features are possible to implement using only objects?"
Programming Languages
What problem does this paper attempt to address?
The paper primarily explores how to implement various advanced features found in other feature-rich object-oriented languages (such as C++, Java, etc.) in an extremely minimalist object-oriented programming language called EO. The author poses a research question: "Which known language features can be implemented using only objects?" To answer this question, the author selects a series of complex features and demonstrates how to simulate these features in EO, a language that only has objects and their composition and decoration mechanisms. The paper discusses in detail features including unconditional jumps, data and code pointers, procedures, classes, exception handling, anonymous functions, generators, types and type conversion, reflection, static methods, inheritance, method overloading, Java generics, C++ templates, mixins, and annotations. For each feature, the author provides translation examples from other languages (such as C, C++, Java, Ruby, etc.) to EO and explains how to use objects in EO to implement these features. The paper also mentions the implementation of some complex features, such as multiple returns, pointers, polymorphic inheritance, etc., and demonstrates how to simulate these features through mechanisms like object copying and decoration. Additionally, the author explores how to represent type systems, reflection, mixins, and annotations in EO. Finally, the paper emphasizes that EO, as a minimalist language, can express advanced features from other languages while retaining the core concepts of object-oriented programming. Although EO does not include a traditional type system or other language features, it can still achieve these functionalities by cleverly utilizing objects and their composition and decoration mechanisms. In summary, this paper, through concrete examples and detailed explanations, proves that many complex language features can be simplified into object operations, thereby validating the power and flexibility of EO as a minimalist language.