After all the discussion / suggestions that have been part of this thread, I like the following best:<br><br>local(scope_name)<br>&nbsp; set(var1 &quot;value1&quot;)<br>&nbsp; set(var2 &quot;value2&quot;)<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 &quot;CACHE&quot; arg is used
<br>- perhaps a &quot;PARENT_SCOPE&quot; 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 &quot;local&quot;/&quot;endlocal&quot; 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> &lt;<a href="mailto:miguelf@ieee.org">miguelf@ieee.org</a>&gt; 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>&gt; On Friday 02 November 2007, KSpam wrote:
<br>&gt; &gt; Brandon,<br>&gt; &gt;<br>&gt; &gt; You missed the part where Bill mentioned that variable_scope would take<br>&gt; &gt;<br>&gt; &gt; multiple arguments.&nbsp;&nbsp;Your example:<br>&gt; &gt; &gt; variable_scope_begin(scratch_preamble)
<br>&gt; &gt; &gt; variable_scope_begin(got_match)<br>&gt; &gt; &gt; variable_scope_begin(not_trail)<br>&gt; &gt; &gt; variable_scope_begin(empty)<br>&gt; &gt; &gt; # [...]<br>&gt; &gt; &gt; # my actual code, blah blah blah
<br>&gt; &gt; &gt; # [...]<br>&gt; &gt; &gt; variable_scope_end(scratch_preamble)<br>&gt; &gt; &gt; variable_scope_end(got_match)<br>&gt; &gt; &gt; variable_scope_end(not_trail)<br>&gt; &gt; &gt; variable_scope_end(empty)
<br>&gt; &gt;<br>&gt; &gt; would reduce to:<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variable_scope_begin(scratch_preamble got_match not_trail empty)<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # [...]<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # my actual code, blah blah blah<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # [...]<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variable_scope_end(scratch_preamble got_match not_trail empty)<br>&gt;<br>&gt; How about naming it &quot;declare_local_vars(&lt;vars&gt;)&quot; or just &quot;local(&lt;vars&gt;)&quot;
<br>&gt; instead of variable_scope_begin() and have it end always at endmacro() ?<br><br>I like both alternative names better, but can&#39;t rely on endmacro() for<br>ending since this causes an unnecessary limitation. That is, you&#39;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>