Most object-oriented languages support the object-oriented paradigm by employing the concept of classes. However, classless (or object-based) object-oriented languages are also a viable alternative. Self, the first object-based language was based on prototypes, but since then languages with other classless designs have been created too. The classless object system in these languages provides a more regular and conceptually simpler alternative to class-based ones. Although, a common criticism of such languages is that modeling inherently abstract concepts is difficult in them.
One implementation reuse mechanism frequently employed by classless languages is delegation, a form of object-based inheritance. Delegation offers greater flexibility and more power than traditional class-based inheritance. However, the static typechecking of delegation – especially dynamic delegation – can be difficult.
Static typechecking offers numerous advantages, for example it assists the early detection of bugs. The form of static typing used in mainstream languages employs nominative type systems, so subtyping relationships have to be explicitly declared by the programmer. On the other hand, in languages using structural type systems, the typing and subtyping relations are based on the actual structure (or behavior) of objects, so explicit subtyping declarations are not necessary. As a consequence, structural type systems support unanticipated reuse.
In this thesis, I present the design and implementation of a new object-based programming language with structural typing and dynamic delegation. I also compare traditional class-based object systems with object-based ones. The advantages of structural typing and delegation are also described. The new language combines the flexibility of dynamic delegation with the safety of static typechecking. With the concept of abstract slots, it is also able to represent inherently abstract concepts without the use of classes. The implementation of the language – a tree-based interpreter – is also described. The abilities of the language are also demonstrated with working examples.