From: Marc P. <ma...@an...> - 2003-04-20 02:03:17
|
On Sat, 19 Apr 2003 11:37:05 -0700, Brian Goetz <br...@qu...> wrote: > I'm really sorry you thought thats what we had in mind when we built > #macro, but it wasn't. You're right, you can't do it with #macro. > I'm sorry you thought you could. The WM #macro facility was designed > to work like the C #define facility. > > And that's still pretty damn useful! OK Brian, thanks for explaining this fully. I completely understand now. However I am sure I will not be the last person to make this mistake - it's certainly unintuitive if you don't have a deep understanding of the way it is written. I really think that WM -must- have some kind of runtime-evaluated callable (and recursable) block mechanism otherwise we are really going to have huge problems with any kind of tree traversal. Should we really worry about infinite loops when (a) you can do this with #include, and (b) Java will likely catch it anyway with StackOverflow, depending on how the parser/evaluation works. The #template thing you mentioned sounds like a better option that the modified #include syntax, to me at least. I really think webdesigners (not programmers) will have trouble understanding the "limitations" of #macro so we should find a way to make it abundantly clear what it cannot be used for. However, I would wager that most web designers would still think "Well why the hell is that, that's a real pain". Here's an idea: Can we make #macro work out if it is being used "badly" i.e. calling other #macros? If so we should definitely trap this. BETTER still make it work in two modes have an extra parameter #macro static MyMacro { } or #macro dynamic $MyMacro { }, so that dynamic macros are evaluated at runtime instead, static ones at build time? Is this possible, or best done with a separate macro? Doing it in #macro will show people that there is a different behaviour, and by default I think we should make it "dynamic" i.e. runtime evaluated. Or, we could have a setting for you folks who are #macro addicts - MacroDirective.DefaultMode: static Perhaps we should just do #function MyFunc ($arg1, $arg2) and #functioncall MyFunc(1,2) I haven't based a system around this, it's just that I want to produce the webapp docs from XML source because it's quick and easy, and #macro looked like it would fit the bill. Right now I'm going to have to go for the very ugly #include :( Thanks for your patience with my misunderstanding, Marc -- Marc Palmer (Wangjammer5) http://www.wangjammers.org Java Consultants |