diverse-project / k3

action language providing open class mechanism to xtend/java
http://diverse-project.github.io/k3/
Eclipse Public License 1.0
25 stars 8 forks source link

"K3 Project" wizard with "User Ecore Basic Aspects With Melange" template leads to invalid Melange file #49

Open ebousse opened 7 years ago

ebousse commented 7 years ago

When creating a new "K3 Project" with the "User Ecore Basic Aspects With Melange" template, the generated melange file has several problems, including:

Example:

package packageName

import static extension fr.inria.diverse.melange.lib.MetamodelExtensions.*

metamodel MyMetamodel {
    ecore "platform:/resource//as/model/My.ecore"
    exactType MyMetamodelMT
}

transformation execute(MyMetamodelMT mymodel) {
    val root = mymodel.contents.head as MyMetamodel

    print("root: ")
    println(root)
}

@Main
transformation main() {
    val m1 = MyMetamodel.load("input/Simple.xmi",      MyMetamodelMT)

    execute.call(m1)
}
dvojtise commented 7 years ago

Additionnaly, only external language would make sense in case of mixed K3/Melange projects

For "normal / non external" languages, Melange copies the aspects in the runtime language. Thus the original aspect classes are useless when the language is deployed. they are used only at compilation time then at runtime only the copies are useful.

Inn case of external language, the contract is that the aspect doesn't changes the language signature, they only implements the predefined operations, thus the original aspect classes can be used.