The purpose of the research is to develop a conceptual model of an object oriented system and implement it using a functional language with metaprogramming support. Methods. A conceptual model of an object oriented system was developed based on a dynamic object system with message passing and dynamic dispatch. The developed object oriented system includes functions for creating and deleting classes, creating and deleting object instances of a class, functions for working with object properties, functions for adding methods to a class and passing messages. Inheritance is also possible, when a child class will have the properties of the parent class and its own properties. Results. The object oriented system was implemented using a set of macros and helper functions. The basic data structure was a hash table with key access capabilities, which was also implemented using macros. When a class is created, an instance constructor is automatically generated, setting the initial values of the object’s fields. Inheritance is implemented as the inclusion of fields of a parent class in a child object. Polymorphism is implemented as dynamic dispatch: when processing a message, a handler method is searched. The resulting object oriented system, together with the hash table module, occupies 97 lines. Conclusion. As a result of the work, a conceptual model of an object oriented system was created and implemented, which includes the main functions of the object oriented programming paradigm. It has been shown that macros can be used to create a compact object oriented system without the need to add any new functions or capabilities to the functional language interpreter.
Read full abstract