From: Thant N. <na...@ee...> - 2003-07-30 07:20:59
|
Is it possible to get the name of a Tcl proc within its own body? If so, how can I do that? I was trying something like :- ## Start set value(name1) 1 set value(name2) 2 set nameList "name1 name2" foreach nn $nameList { proc $nn { } { global value return $value($nn) } } ## End When I called the proc "name1" or "name2", I got the error like:- 'can't read "nn": no such variable'. The point is - how could I get to resolve "$nn" within the body to the proc name at the declaration time? Thank you. |