Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Xpand and Xtend2/Xtext
Xpand and Xtend2/Xtext [message #798256] Tue, 14 February 2012 12:47 Go to next message
Anders S is currently offline Anders SFriend
Messages: 29
Registered: February 2011
Junior Member
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 13:28 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

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


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Xpand and Xtend2/Xtext [message #798492 is a reply to message #798277] Tue, 14 February 2012 19:05 Go to previous messageGo to next message
Anders S is currently offline Anders SFriend
Messages: 29
Registered: February 2011
Junior Member
Thank you for a great answer!

Karsten Thoms wrote on Tue, 14 February 2012 08:28

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.


As I stated in my first post, I have a custom metamodel(perhaps called metameta-model in the documentation) for Xpand, ie. my own mapping of types to Xpand. With this I have an environment for creating templates for a custom modeling language.
What you are saying is that this is not possible in Xtend2? If so, will this become possible in the future?


Re: Xpand and Xtend2/Xtext [message #798494 is a reply to message #798492] Tue, 14 February 2012 19:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i guess it will not be possible. but depending on what you are actually doing in your custom metamodel it might work anyway.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xpand and Xtend2/Xtext [message #799051 is a reply to message #798494] Wed, 15 February 2012 11:33 Go to previous message
Anders S is currently offline Anders SFriend
Messages: 29
Registered: February 2011
Junior Member
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?


Previous Topic:Problems with Xpand
Next Topic:Exception generation
Goto Forum:
  


Current Time: Thu Apr 25 02:23:42 GMT 2024

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

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

Back to the top