melange icon indicating copy to clipboard operation
melange copied to clipboard

Metamodels' transformations and operations definition

Open tdegueul opened this issue 10 years ago • 0 comments

Currently, operations are associated to metamodels or model types through the definition of transformations:

modeltype  A { ... }
metamodel X implements A { ... }
transformation foo(A a) { ... }
@Main transformation bar() { foo.execute(new X) }

A simple enhancement would be to allow the direct invokation of transformations whose first argument is a metamodel or model type:

modeltype  A { ... }
metamodel X implements A { ... }
transformation foo(A a, String s) { ... }
@Main transformation bar() {
    val x = new X
    x.foo("abc")
}

Similarily, operations could be defined in a more "object-oriented style":

modeltype  A {
    operation A foo(String s) { return this }
}
metamodel X implements A { }
metamodel Y inherits X implements A {
    override A foo(String s) { return ... }
}
@Main transformation bar() {
    val x = new X
    val y = new Y
    x.foo("abc") // X::foo
    y.foo("abc") // Y::foo
}

This would make explicit, e.g. the specialization of operations through the languages hierarchy.

tdegueul avatar Jan 26 '15 10:01 tdegueul