Thu Apr 3 07:39:22 EDT 2008
every macro a parameter?
What about defining extensions as a functions that installs
environment modifications and runs a thunk? This allows to keep at
least the most basic functionality intact, and allows specific
extensions to be represented by an object.
To come back to yesterday's remarks: i'm a bit uncomfortable with
extension of low-level components without being able to undo
those. Carefully building a bottom-up structure and then starting to
poke around in its innards without 'undo' mechanism seems wrong..
So what is the real reason for needing this poking? The macros employ
target specific optimizations.
This should solve it:
(define (make-macro . args)
(make-parameter (apply make-word args)))
Hmm.. where to introduce? First naive replacement does violate
something.. a lot of code assumes macros are functions.
Maybe in 'make-word' ?
Maybe using dynamic-wind is still the best approach. The problem is
that my representation type isn't abstract enough: i really would like
it to be a procedure mapping state->state.
So.. is dynamic-wind thread-local? Maybe that's the big difference.
So what about this: keep word interface like it is, but provide a
words-parameterize form: if it can't be solved with straight
parameters because they are procedures, solve it on the other side of
some auto-upgrade is added so it is not NECESSARY to specify that
words are parameters when the auto-upgrade words are
available. however, it is possible to PREVENT words from becoming
parameters by not exporting the auto-upgrade functions.
this looks like it's flexible enough. now to adjust the compositions
and patterns macros to use this.
got 'with-compositions' working, but it needs a 'super' too.
got 'super' working too.
so now the mechanism for extending the compiler is in place: every
word can be replaced in dynamic context + a mechanism for at least
limiting some replacement can be easily installed.
EDIT: got pic18 compiling with redefined core words. now.. get rid of
the parameters in target.ss and make those into re-definable word
too. then it should be mostly done.
* remove target-postpone-* parameters in macro-lang.ss and replace
them by parameterized words. OK
* same for split / label? -> NO: special api