Wed Jun 25 19:34:45 CEST 2008
from the blog post, which will probably be edited once i find a way to
express this properly (and solve the problem maybe..)
Now, that's a nice story, but that's not how it happened :) The
specification of rewriting rules came natural as a syntactic
abstraction for some previously manually coded peephole
optimizations. This rewrite system however seemed way more useful
than just for performing simple optimizations, and by introducing
pseudo target assembly instructions has been transformed into a
different kind of two-level language semantics: powerful compile
time type system with an analogous run time type system with
'projected semantics' derived from eager macro rewrite rules.
The downside of this is that in order to write programs, one has to
make decisions about what to instantiate, and what not. It might be
interesting to try how far this can be automated: don't instantiate
what cannot be instantiated, but try to isolate subprograms that
have real semantics.
Q: macro semantics and target semantics are not the same for some
words like '+'. is this good or bad? it's useful for computing
constants, but dangerous for overflows. is it better to
completely embed the target semantics, and use different symbols
for the metaprogramming operations?
Q: is automatic instantiation really that difficult?
compile time + might be seen as a different type.. (like + and +. in
except for optimality (inlining might sometimes be better), solving
the instantiation problem based purely on semantics (inline when a
composition is 'real' + doesn't mess with the target interpreter)
might not be so difficult.