[<<][compsci][>>][..]
Thu Sep 3 11:27:47 CEST 2009
Metaprogramming Patterns
Two topics:
- I am focussing on building stagable abstractions on top of
combinatory circuits for real-time DSP applications. This should
yield a series of small DSLs and DSL -> C compilers.
- Jacques Carette's approach to finding a list of metaprogramming
patterns[1].
The latter paper talks about 1. the need for CPS-style programming to
assure proper name generation (``let insertion'') for storing
intermediate results and 2. a way to solve the notational problems
using a monad (which can then accomodate other effects).
I currently don't see how this can be used to bring these techniques
``to the people'', for the simple reason that it takes me quite some
effort to follow the notation, and I already spent considerable effort
reading about the field. Types bring security, but complicate matters
quite a bit. The payoff might be large, but the investment isn't
neglegible: sometimes it takes a whole lot of maneuvering to express
the static structure you want in the type system. The monadic style
can be relaxed by using control operators[2].
For practical purposes it seems that untyped abstract-evaluation based
approaches are a better way to gently add this to the toolbox of
nuts&bolts embedded software engineering, with the typed approach
currently limited for the construction of software tools by experts in
both the domain _and_ typed functional programming.
What matters in practical / simple DSLs is to provide a good
abstraction (semantics) and notation (syntax), and to allow for static
analysis. Whether the generators _themselves_ are statically verified
is an added safety I see only pay off in very specialized and
error-prone generator applications, unless the notational and
conceptual overhead can be reduced (as seems to be the idea of [2]).
[1] http://www.cas.mcmaster.ca/~carette/publications/scp_metamonads.pdf
[2] http://okmij.org/ftp/Computation/staging/circle-shift.pdf
[Reply][About]
[<<][compsci][>>][..]