The Clump Language

The language proposes a natural evolution of the scandinavian Object-Oriented paradigm revisiting the duality data/knowledges and providing a new approach based on both Class-Oriented and Pattern-Oriented approaches in the same language.

Distribution » Documentation »

Interface

An interface provides behaviors specification giving for each method its corresponding type. This is comparable to the interface defined in Java for example. In addition extensions are available providing modular design approach. It's important to notice that such interfaces provide method definitions but no variable specification.


   interface IAdder<T> {
      T add(T);
   }
	    

Object

An object provides a structure containing a set of named values. Compared to Scandinavian object-oriented approach this structure is comparable to the internal state and nothing else; no behavior was directly linked. In addition a type can be specified based on disjunctive object type definition like functional programming languages.


   object Zero {}
   
   object Succ {
      final Peano value;
      Succ(Peano value) { this.value = value; }
   }

   type Peano = Succ | Zero 
	    

Class

Object behaviors are described and given by classes like classical Scandinavian object-oriented approach. But these behaviors are organized by sets called views and each set is dedicated to a given object form or pattern i.e. its type. Compared to classical approach instead of providing two classes - one per object form - only one class with two different views can be proposed.


   class peano(Peano) implements IAdder<Peano> {
      case Zero add(p) { 
        return p; 
      }   
      case Succ add(p) { 
	return new Succ(peano(this.value).add(p)); 
      }
   }