LMS stands for
Lightweight Modular Staging. For a definitive guide see Tiark Rompf's Ph.D.
dissertation:
Lightweight Modular Staging and Embedded Compilers: Abstraction Without Regret for High-Level High-Performance Programming
I am still studying it but this seems like a very interesting approach to solve the expression problem without sacrificing performance. Let me quote from the
tutorial page:
"Why Generative Programming ?
Because it enables abstraction without regret: the key idea is to write very high-level
and generic programs that generate specialized and extremely fast low-level code at runtime.
Programming abstractions that would usually be avoided in performance-sensitive code
(objects, type classes, higher-order functions) can be used during generation without
affecting performance of the generated code.
Why LMS ?
Because it is lightweight and modular: LMS is just a Scala library. With types, it distinguishes
expressions that are evaluated now (type T) vs later (type Rep[T]).
LMS comes with batteries included: it provides many optimizations such as common subexpression elimination out of the box, and it goes beyond purely generative approaches by
providing an extensible intermediate representation that can be used to implement
sophisticated domain-specific compiler pipelines.
At the same time LMS is hackable: since it is just a library, all aspects can be
modified or extended to suit a particular purpose."
I wonder if ATS's very expressive approach can support such a paradigm. For a motivational example (motivation for me anyway) see:
A SQL Query Compiler. This approach is used in
LegoBase to very good effect. I think it is very attractive if we can mix in relational declarative programming this way with imperative programming that can supply large amount of libraries and take care of side effects.