> No - 'global' and 'variable' will stay. Where did you get that from? 

Well, this program ceased to work:

--8<------------------------------------------
set mytest 1
puts $mytest

namespace eval myspace {
  global mytest

  puts "mytest in myspace is $mytest"
}
-->8------------------------------------------

So, what is global doing then?

Here, http://wiki.tcl.tk/1508, I read that global foo is
equivalent to upvar #0 foo foo.
That is not quite the case anymore, because, when I replace "global
mytest" by "upvar #0 mytest mytest", the above program works again.

JeeBee


The error I get is:
$ tclsh8.5 foo.tcl
1
can't read "mytest": no such variable
    while executing
"puts "mytest in myspace is $mytest""
    (in namespace eval "::myspace" script line 5)
    invoked from within
"namespace eval myspace {
  global mytest
  #upvar #0 mytest mytest

  puts "mytest in myspace is $mytest"
}"
    (file "foo.tcl" line 5)



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Amsn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to