Xpand/New And Noteworthy
Xpand is now shipped with an optional incremental generation facility. This works very similar to the incremental Java compiler in Eclipse. It detects which parts of a model have changed since the last generation process. It then determines which files need to be generated due to that change and which are unaffected by it. Only the former are the regenerated, while the latter remain untouched.
Big models benefit from this feature. The generation of models with 1000 elements takes 50% of the time without incremental generation.
In large projects, generator speed is an issue, and the backend is designed with performance in mind. This requirement is what actually sparked its development in the first place. For performance and/or obfuscation reasons, the backend will serve as a basis for compilation into Java classes.
The design was driven by the following forces:
- Language independence
- Independent of parse tree
- Language interoperability
- Reuse of Tooling
Xpand provides profiler facilities by defining a profiling component. An example workflow using the profiler is shipped with the generator sample project (generatorWithProfiler.mwe).
A lot of enhancements are done for the Xpand editors.
- The navigation of the Xpand editors is improved by more specific navigation proposals
- Extension imports are now hyperlinks to the extension files
- The Xpand project wizard allows a more detailed project configuration
- A lot of other enchantments like markers for missing/not existing metamodels
- ONFILECLOSE: The ONFILECLOSE keyword is added to the EXPAND statement and allows a derefered evaluation of the EXPAND statement. The evaluation of the EXPAND statement is defefered until the FILE statement is closed.
- Java extensions: Since Xpand 0.8.0 non-static Java method can be called from Xtend.
The 0.7.0 version of the Xpand component from M2T is the first official Eclipse release of it. Xpand is a statically typed template language, featuring polymorphic dispatch, extensions and an open pluggable type system. It comes with Eclipse-based IDE support.
Xpand has previously been a part of openArchitectureWare and is used in many big projects and also shipped with some commercial products.
For the 0.7.0 release, the team has done some major performance improvements. Not only the runtime is up to 60% faster but due to aggressive caching we were able to improve the performance of the static analysis in the IDE about 400%.
As this is the first release at Eclipse, some of the UI-features are outlined here.
When you open Eclipse and import a project into the workspace you can see several file decorating images.
There are specific images for
- Xpand2 templates (.xpt extension)
- Extension files (.ext extension)
- Check constraints (.chk extension)
When you double-click on one of the above mentioned file types, special editors will open that provide appropriate syntax coloring. Syntax coloring
Here are examples for the Xpand editor:
for the Extensions editor:
and for Check editor:
The Editors provide extensive code completion support by pressing Ctrl + Space similar to what is known from the Java editor. Available types, properties, and operation, as well as extensions from .ext files will be found. The Xpand editor provides additionally support for the Xpand language statements. Xpand tag delimiter creation support.
In the Xpand editor there is an additional keystroke available to create the opening and closing tag brackets, the guillemets ("«" and "»").
Ctrl + < creates "«"
Ctrl + > creates "»"