-
Hello, I am currently diving into Langium and thinking about a possible migration of two Xtext DSL projects. The bigger one heavily utilizes Xtend features for having precise an cleanly structured code, for example for the validation layer as well as a code generator. While I am not totally new with Node and TypeScript, I am not sure yet how to rewrite such things and whether there already are replacements available out of the box. Can you post a few simple examples of how you do that stuff we love Xtend for, particularly extension methods (and chaining their calls), polymorphic dispatching and functional expressions for working with collections? Thanks in advance for your advice. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@sailingKieler Can we get some input from you? I believe you migrated a fairly sizable Xtext/Xtend code base recently. Aside from that, we do actually have a few replacements for the things you mentioned in your post @Guite:
We generate special
Langium exposes a
Extension methods aren't really supported in TypeScript, so nothing we can really do there. Then there's also the whole string templating thing in Xtend, for which we also have an replacement. See some of our blogposts. |
Beta Was this translation helpful? Give feedback.
@sailingKieler Can we get some input from you? I believe you migrated a fairly sizable Xtext/Xtend code base recently.
Aside from that, we do actually have a few replacements for the things you mentioned in your post @Guite:
We generate special
is<type>
methods for each type in your grammar that has a special type indicator return type. It can be used to write code that is very similar to the polymorphic dispatching from Xtend (but not quite as concise). See here for an example.Langium exposes a
Stream
interface (and an associatedstream
method to convert any iterable into a stream) that acts as a direct repl…