Xpand and Xtend2/Xtext [message #798256] |
Tue, 14 February 2012 07:47  |
Eclipse User |
|
|
|
Hi!
I have created a custom metamodel for Xpand the last few months. And have recently realized that the template expression stuff in Xtend is the "new" Xpand. I have a few questions regarding this.
How does the old "components" in Xpand fit into Xtend2? Does it fit at all?
I use a metamodel which ofcourse inherits the MetaModel, along with custom types which is used within the metamodel.
From the little I have seen, it seems that you work directly on the java objects, which means that you wont be able to create custom methods and types for your metamodel.
Is it at all possible to migrate the old solution to Xtend2? Is it worth it?
Is the development of Xpand stopped in favour of Xtend2?
Questions I asked earlier about developing the metamodel etc.:
http://www.eclipse.org/forums/index.php/m/740250/#msg_740250
http://www.eclipse.org/forums/index.php/m/757511/#msg_757511
|
|
|
Re: Xpand and Xtend2/Xtext [message #798277 is a reply to message #798256] |
Tue, 14 February 2012 08:28   |
Eclipse User |
|
|
|
Quote:How does the old "components" in Xpand fit into Xtend2? Does it fit at all?
If you mean the Generator workflow component, there is a similar one in Xtext, which assumes that you have an Xtend class configured in the guice config that implements IGenerator. For Xtext based models this works quite out-of-the-box, and an appropriate workflow is generated for you. For other workflows you will have to provide a Guice Runtime Module and an implementation of ISetup to use this component. Or you write your own one deriving from AbstractWorkflowComponent2.
Quote:Is it at all possible to migrate the old solution to Xtend2?
Possible, of course. Automatic - no. This is a migration project. But you could translate Xpand to Xtend Rich Strings and Xtend1 functions to Xtend2 methods quite straight forward.
Quote:Is the development of Xpand stopped in favour of Xtend2?
More or less. Xpand will be maintained for some time, but development effort is put into Xtend2.
Quote:Is it worth it?
Yes. The tooling for Xtend is now already much better than for Xpand. Further, Xtend2 compiles to Java. The resulting code has just minimal runtime dependencies and is hell fast. Xpand is an interpreted approach and naturally slower. However, code generation performance is usually not a direct problem until reaching large scale models or generators.
There are also some gaps that Xtend has against Xpand and probably does not close in mid-term. One prominent example are the extensible type systems, especially the UML typesystem. When working with profiled UML models Xpand is definetely the best approach so far.
Kind regards,
~Karsten
|
|
|
|
|
Re: Xpand and Xtend2/Xtext [message #799051 is a reply to message #798494] |
Wed, 15 February 2012 06:33  |
Eclipse User |
|
|
|
In essence I do the same as say EMFRegistryMetaModel... I map my types to custom Xpand types.
It seems to me that when using template expressions in xtend, this isnt backed by any metamodel, and works directly on any available java objects instead of types derived from the metamodel?
Also it seems like this approach blurs the line between template code and logic; isnt that a bad thing?
|
|
|
Powered by
FUDForum. Page generated in 0.04251 seconds