After all the discussion / suggestions that have been part of this thread, I like the following best:<br><br>local(scope_name)<br> set(var1 "value1")<br> set(var2 "value2")<br>endlocal(scope_name)<br>
<br>function(fname same args as macro)<br>endfunction(fname)<br><div><span class="gmail_quote"><br>- local/endlocal pairs should be nestable<br>- any SET within the local scope would made only in the local scope unless the "CACHE" arg is used
<br>- perhaps a "PARENT_SCOPE" keyword could be used with SET to set something back out in the containing scope<br>- function would be identical to macro except it would have an implied "local"/"endlocal" with the scope_name the same as the function name
<br>- it would be nice for functions to have an easy to use return value<br><br><br>On 11/3/07, <b class="gmail_sendername">Miguel A. Figueroa-Villanueva</b> <<a href="mailto:miguelf@ieee.org">miguelf@ieee.org</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 11/3/07, Alexander Neundorf wrote:<br>> On Friday 02 November 2007, KSpam wrote:
<br>> > Brandon,<br>> ><br>> > You missed the part where Bill mentioned that variable_scope would take<br>> ><br>> > multiple arguments. Your example:<br>> > > variable_scope_begin(scratch_preamble)
<br>> > > variable_scope_begin(got_match)<br>> > > variable_scope_begin(not_trail)<br>> > > variable_scope_begin(empty)<br>> > > # [...]<br>> > > # my actual code, blah blah blah
<br>> > > # [...]<br>> > > variable_scope_end(scratch_preamble)<br>> > > variable_scope_end(got_match)<br>> > > variable_scope_end(not_trail)<br>> > > variable_scope_end(empty)
<br>> ><br>> > would reduce to:<br>> ><br>> > variable_scope_begin(scratch_preamble got_match not_trail empty)<br>> > # [...]<br>> > # my actual code, blah blah blah<br>
> > # [...]<br>> > variable_scope_end(scratch_preamble got_match not_trail empty)<br>><br>> How about naming it "declare_local_vars(<vars>)" or just "local(<vars>)"
<br>> instead of variable_scope_begin() and have it end always at endmacro() ?<br><br>I like both alternative names better, but can't rely on endmacro() for<br>ending since this causes an unnecessary limitation. That is, you'd
<br>want to use this in FindXXX.cmake modules and other scripts not only<br>macros.<br><br>--Miguel<br>_______________________________________________<br>CMake mailing list<br><a href="mailto:CMake@cmake.org">CMake@cmake.org
</a><br><a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>