The simplest way is to just name the target namespace in the variable
call, but if you do that, you should make the namespace as a separate step (if it is possible to call the code at a point when the NS wasn't already created).
namespace eval gen {
proc generate { } {
# Make the namespace by running an empty script in it
namespace eval current_file_generation_info {}
# Initialise the variable
variable current_file_generation_info::language "C"
}
}
Otherwise, you could do:
namespace eval gen {
proc generate { } {
namespace eval current_file_generation_info \
[list variable language "C"]
}
}
Hint: the list
command is very good at generating substitution-free scripts that call a single command.