Tingle is the first idea oriented programming language. As object oriented programs have classes as their basic components, idea oriented programs have ideas, named after Platonic Ideas. Ideas do not build on other ideas, as classes extend other classes; instead they are independent, but they click together when used in combination, without any need for traits-style glue. Through this property, they can also serve as classes, as mixins, even as dynamically activated layers (as in context oriented programming).
The secret sauce is one single innovation: the emancipation of the lexical scoping of methods from the composition of classes. Traditionally, composition determines scoping: for instance, subclassing adds new components to a class, which can override other components and have them in scope; and similarly, in a language with mixins, the order in which they are combined creates scoping; but here the roles are reversed, and scoping determines composition.
This introduction to Tingle should serve as proof that idea oriented programming is actually doable, as well as possible. In particular it should show that Tingle code is neat and concise, and that the language encourages separation of concerns. It will therefore present the beginnings of a programming style that agrees with the language, while not looking too foreign to object oriented programmers.
The first three sections cover the basics: after we have explained the difference between ideas and classes in section 1, section 2 introduces the concept of "top method", and section 3 explains scoping in detail.
The next three sections are about programming in the small: section 4 compares composition with traditional subclassing and gives some pointers about programming style, section 5 goes into the relationship between ideas and mixins, and section 6 introduces simple templates.
Then we need to say something about programming in the large. Section 7 introduces name spaces, which allow us to reuse library components as black boxes, either in isolation or with mixins. Section 8 refines the scoping rule, which additionally allows us to bring library components in scope as black boxes, so that we can emulate subclassing again, if we want to.
The next two sections adapt well-known features from other languages to Tingle. Section 9 explains how the concepts of "public", "private" and "protected" fit in, and adds an extra category. Section 10 adapts Scala companion objects. Section 11 wraps up with some general remarks.
There are two appendices, which apply specifically to Tingle, not to idea oriented programming in general. Appendix A demonstrates some dynamic features of the language. Appendix B builds on that to show that ideas can also be used as layers for context oriented programming.
Contents | Section 1: Classes and Ideas