Type Oriented Programming Concept

From Mesham
Revision as of 11:30, 3 July 2010 by Polas (talk | contribs)
Jump to navigationJump to search

Type Oriented Programming

Much work has been done investigating programming paradigms. Common paradigms include imperative, functional, object oriented and aspect oriented. However, we have developed the idea of type oriented programming. Taking the familiar concept of a type we have associated in depth runtime semantics with such, so that the behaviour of variable usage (i.e. access and assignment) can be determined by analysing the specific type. In many languages there is the requirement to combine a number of attributes with a variable, to this end we allow for the programmer to combine types together to form a supertype (type chain.)

Type Chains

A type chain is a collection of types, combined together by the programmer. It is this type chain that will determine the behaviour of a specific variable. Precidence in the type chain is from right to left (i.e. the last added type will override behaviour of previously added types.) This precidence allows for the programmer to add additonal information, either perminantly or for a specific expression, as the code progresses.

Type Variables

Type variables are an interesting concept. Similar to normal program variables they are declared to hold a type chain. Throughout program execution they can be dealt with like normal program variables and can be checked via conditionals, assigned and modified.

Advantages of the Approach

There are a number of advantages to type oriented programming

  • Efficiency - The rich amount of information allows the compiler to perform much static analysis and optimisation resulting in increased efficiency.
  • Simplicity - By providing a clean type library the programmer can use well documented types to control many aspects of their code.
  • Simpler language - By taking the majority of the language complexity away and placing it into a loosely coupled type library, the language is simplier from a design and implementation (compiler's) point of view. Adding numerous language keywords often results in a brittle design, using type oriented programming this is avoided
  • Maintainability - By changing the type one can have considerable effect on the semantics of code, by abstracting the programmer away this makes the code simpler, more flexible and easier to maintain.