From: Marc P. <ma...@an...> - 2003-07-26 22:17:45
|
On Sat, 26 Jul 2003 13:24:39 -0700, Brian Goetz <br...@qu...> wrote: >> I'm not sure what we can do about this. I mistakenly thought #macro >> would have a separate context for its arguments, and as such changes to >> an outer variable would not suddently change the value of a differently >> named parameter to the macro. > > Nope, not how it works, nor how it was intended to work -- otherwise > you couldn't have macros that modified their arguments. That's why I said "mistakenly" in the above, and why I asked "Is this a bug". >> So, is this a bug or a "feature"? > > Feature. Just like C macros. If you intend to have local variables, > name them in such a way as to never conflict, just like in C. Fine, and that's exactly what I suggested as the workaround. The point is, as much laboured before, that template writers will not get this. They are not C programmers. Roll on #templet/#eval :) > Macro-local variables would be nice -- want to add them? Perhaps, although I'm more concerned with not having the values of arguments change because a global variable used as the value of that argument changed - i.e. snapshot the context somehow. While macros have an optimisation advantage, I think this work would not be worthwhile when #templet is ready for prime time. Marc -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |