proc foo {param} {
namespace eval foo_ns {
uplevel {set foo_ns::x $param }
}
}
This just looks ugly.
[upvar] will not work, because it can't link to 'param'.
Thanks.
Code from answers does not work (tclsh8.4)
-------------------------------------------
% proc bar {param} {
namespace eval foo_ns {
uplevel [list set foo_ns::x $param]
}
}
% bar 123
can't read "param": no such variable
-------------------------------------------
% proc foo {param} {
set ::foo_ns::x $param
}
% foo 123
can't set "::foo_ns::x": parent namespace doesn't exist