From: Brian G. <br...@qu...> - 2003-04-19 18:50:37
|
Marc has raised an issue that no one else has so far regarding #macro. He wants to write #macros to traverse DOM style trees at runtime. You can do this more clumsily with (lazy) #include, but that's kind of nasty. Justin had floated an idea at one point for a directive like #template: where you could say #template { blah blah $a blah $b } in a template, and then #include it later in the template. It was a crude macro facility with no substitution, or an #include facility without using ancillary files. Another suggestion made at one point would be to allow some sort of substitution with #include -- like this (assuming a map-style syntax): #include "foo.wm" using [ $a => "foo", $b => "moo" ] which would be like #push $a #push $b #set $a = "foo" #set $b = "moo" #include "foo.wm" #pop $b #pop $a Where #push and #pop do the obvious thing. Or, perhaps this is a better syntax for a temporary substitution: #with ($a="foo", $b="bar") { #include "foo.wm" } Combining these would get the tool that Marc is looking for (lets calls these Marcros.) However, I think its worth having a discussion about whether this is a good thing. We don't even have a loop directive because we don't want to put users in a situation where they can create infinite loops at run time. |