[Xbase] FeatureCall Scoping problems with DomainModelExample [message #698948] |
Wed, 20 July 2011 14:34 |
Ingo Meyer Messages: 162 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'm trying to get some basic scoping functions to work with the DomainModelExample.
As I found out so far, inside an Entity I can just reference to local features.
But what if this is not wanted. As Xtext DSLs should be external DSLs, everything should be possible...
1)
I want Operations also to be a child of a Package directly. This fails with the JvmModelInferrer and I don't see any possibility to fix it. So whatever I want to bind to JVM types it must be inside a JvmGenericType, right? If so, this can be a big problem in my opinion.
Here the grammar change:
AbstractElement:
PackageDeclaration | Entity | Import | Operation;
2)
Inside an Operation using a Constructor with an own entity fails. The UI is blocked when hovering and the Entity will not be resolved. I guess someting with the missing default constructor in the JvmGenericType?
3)
If I want to call an operation from another Entity it will not be resolved (yes, I want to have it in this "static-like" way!).
I think the scoping has to be extended for FeatureCalls, but there is no docu yet.
How can I put any element in the scope of a FeatureCall?
4)
Another problem may be the case when Entities with same names exists in different Packages. In FeatureCalls it is not possible to write FQNs right? So how to qualifiy a name then? Just the Import function will not be sufficient in bigger models!
Here is my complete test model with some comments:
package p1 {
entity E1 {
ps : int
public op op1 () : int {} // what function has the public keyword here?
}
entity E2 {
ps : int
}
entity E3 {
ps : int
}
// public op op1 () : int {} // how to make this possible here?
}
package p2 {
entity E1 {
ps : int
public op op1 () : int {} // what function has the public keyword here?
}
entity E2 {
ps : int
}
entity E3 {
ps : int
}
// public op op1 () : int {} // how to make this possible here?
}
package p3 {
import p1.*
entity E1 {
ps : int
t1 : E1 // ok
t2 : p1.E1 // nice, this one works cause rule JvmParameterizedTypeReference: type=[JvmType|QualifiedName]
t3 : p2.E1 // nice, this one works cause rule JvmParameterizedTypeReference: type=[JvmType|QualifiedName]
}
entity E2 {
ps : int
}
entity E3 {
ps : int
op op2 () : int {
val a1 = new Double('')
val a2 = new E1() // how to make this work? local E1
val a3 = new p1.E1() // how to make this work? E1 from package p1
val a4 = new p2.E1() // how to make this work? E1 from package p2
ps = a2.ps // guess it works if a2 works?
this.ps = a3.ps // guess it works if a3 works?
this.ps = a4.ps // guess it works if a4 works?
val o1 = op1() // how to make this work if Operations under Packages are working?
val o2 = p1.op1() // how to make this work if Operations under Packages are working?
val o3 = p2.op1() // how to make this work if Operations under Packages are working?
val b1 = op2()
val b2 = E1.op1() // how to make this work? op1 from E1 from package p1
val b3 = p1.E1.op1() // how to make this work? op1 from E1 from package p1
val b4 = p2.E1.op1() // how to make this work? op1 from E1 from package p2
}
}
}
I'm very excited to get those problems solved. Xtext 2 and Xbase seems to be much better then the old version.
In my first generator test it is about 10 times faster!!!
Thanks for the great project and your help
Ingo
|
|
|
|
Powered by
FUDForum. Page generated in 0.02822 seconds