Delirium wrote:
Brion Vibber wrote:
But if we're really, really sure, we can put some time into working on that and accept that our syntax will never be predictable. (This has consequences for future wysiwyg or markup-sensitive assisted editing plugins.)
Isn't it general practice with a macro-like facility like templates not to parse until you've substituted in the preprocessing phase?
That depends on the macro-like facility.
If they're to have some sort of different semantics, that's a different paradigm of sorts---it would require no longer using templates as macros, but as functions that return complete well-formed sub-parts of the page.
In what way is that not like a macro?
Note that the C preprocessor is not the only macro language in existence; it's just a particularly ugly and poorly-integrated example. In fact it's a perfect example of how *not* to design a macro language, since it's impossible to reliably work with C source code programatically due to it. Simple cases mostly work, while mildly complex cases explode dramatically for no apparent reason.
Dumb source-code replacement (like the C preprocessor) is extremely difficult to work with; however parse-tree replacement is clean and easy to work with for analysis, conversion, and editing tools.
-- brion vibber (brion @ pobox.com)