Académique Documents
Professionnel Documents
Culture Documents
Keywords: Object and Class separation and Dynamic typing
Domains: Language semantic, Type checking, Compiler
Language: Clump and Java
[10/05/2010] Release v0.3 of the Clump Language
Object
An object provides a structure containing a set of named values. Compared to Scandinavian objectoriented 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;
}
}
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 behaviors are described and given by classes like classical Scandinavian objectoriented 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. Indeed the old class design still valid based on
behaviors separation for each object form.
class peano(Peano) implements IAdder<Peano> {
case Zero add(p) {
return p;
}
case Succ add(p) {
return new Succ(peano(this.value).add(p));
}
}
Last modified: Mon Oct 11 23:39:30 CEST 2010