3 ms·
Essentially it's an implementation of the concept that metaprogramming should use the same semantics and syntax as normal programming. This is the case in Lisp,
by smaddox 11y ago
Essentially it's an implementation of the concept that metaprogramming should use the same semantics and syntax as normal programming. This is the case in Lisp, for example, but Lisp is not (or not typically) compiled, so Lisp metaprogramming is essentially limited to defining syntactic sugar. In Terra, metaprogramming (or multi-stage programming, as they call it), can actually result in improved performance compared to a typical C-like implementation of the same algorithm.
The website has a couple papers that provide benchmarks for some interesting test cases.
- neukoelln 11y agoI think you are mistaken about Lisp. Most Common Lisp / Scheme implementations I know of are compiled.
- nickpsecurity 11y agoMost are compiled. Many also typically have types you can add in to get performance benefits of static typing. Add in compilation of individual functions and live update of running app to top off key benefits of LISP interpreters/compilers.
- zeveb 11y ago> This is the case in Lisp, for example, but Lisp is not (or not typically) compiled … Say what? Lisp is often compiled; the standard extensively discusses compilation[1] and — to address your point re. performance-improving metaprogramming — compiler macros[2] specifically exist in order to advise the compiler, e.g. for performance. So, no, Lisp macros are not limited to defining syntactic sugar. It's like I keep on saying: the Common Lisp standard from 1994 contains with its covers functionality that people still don't know about. [1] http://www.lispworks.com/documentation/HyperSpec/Body/03_b.htm http://www.lispworks.com/documentation/HyperSpec/Body/03_b.h... [2] http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_c.htm#compiler_macro http://www.lispworks.com/documentation/HyperSpec/Body/26_glo...