Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xbase] FeatureCall Scoping problems with DomainModelExample
[Xbase] FeatureCall Scoping problems with DomainModelExample [message #698948] Wed, 20 July 2011 14:34 Go to next message
Ingo Meyer is currently offline Ingo MeyerFriend
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?

val a2 = new E1()


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
Re: [Xbase] FeatureCall Scoping problems with DomainModelExample [message #698999 is a reply to message #698948] Wed, 20 July 2011 16:00 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
I don't get it...
How can I provide JvmIdentifiableElementelements for Scoping of XFeatureCalls if my DSL is not a simple one following the object oriented pradigm?

If I just create mappings in the Inferrer I get errors like this one:

"The feature 'feature' of 'org.eclipse.xtext.xbase.impl.XFeatureCallImplCustom@7ee1572c{platform:/resource/test2/src/com/xxx/test2/test1.dmodel#/0/@elements.3/@elements.4/@operations.0/@body/@expressions.0}'
   contains a dangling reference 'org.eclipse.xtext.common.types.impl.JvmOperationImpl@5f064398{#///@members.0}'"


How is the concept behind Xbase? How can I use elements which does not fit in a "Java Class"?

I really hope to get help on this one as it is a blocker.
Anyway I will try to figure it out and post my progress here...

Thanks,
Ingo
Previous Topic:Automatic Code completion & automatic indents
Next Topic:Unsettable enum handling
Goto Forum:
  


Current Time: Wed Sep 23 04:38:26 GMT 2020

Powered by FUDForum. Page generated in 0.01877 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top