[CMake] lexical scoping
KSpam
keesling_spam at cox.net
Fri Nov 2 17:57:05 EDT 2007
Brandon,
You missed the part where Bill mentioned that variable_scope would take
multiple arguments. Your example:
> variable_scope_begin(scratch_preamble)
> variable_scope_begin(got_match)
> variable_scope_begin(not_trail)
> variable_scope_begin(empty)
> # [...]
> # my actual code, blah blah blah
> # [...]
> variable_scope_end(scratch_preamble)
> variable_scope_end(got_match)
> variable_scope_end(not_trail)
> variable_scope_end(empty)
would reduce to:
variable_scope_begin(scratch_preamble got_match not_trail empty)
# [...]
# my actual code, blah blah blah
# [...]
variable_scope_end(scratch_preamble got_match not_trail empty)
Of course, if we could get braces into the mix, it would reduce to:
variable_scope(scratch_preamble got_match not_trail empty)
{
# [...]
# my actual code, blah blah blah
# [...]
}
I think that looks pretty good. Even without the braces, the construct is
optional, and it provides a significant improvement in variable safety. I
will trade typing a few more characters for variable safety any day.
Justin
More information about the CMake
mailing list