Am 06.08.2007 um 19:24 schrieb Stephen Deasey: > IIRC namespaced variables aren't touched because it would be too > expensive. > > Do they get cloned at startup though? This test: > > test init-1.4 {namespace variables do not get cloned} -body { > ns_job wait $qid [ns_job queue $qid { info exists > testnamespace::testvariable2 }] > } -result 0 > > ..fails when lazyloader=false, but passes when lazyloader=true. What's > going on here?
Explanation.... Normally the namespace'd variable are copied by the introspective loader based solely on their existence. The lazyloader cannot really know about variable (it is far too expensive to trace [set] command hence I left that out (but is strictly speaking possible and would work). So, it needs to be told with the "variable" command that testvariable2 is a namespaced variable that needs to be copied: namespace eval testnamespace { variable testvariable2 set testvariable2 dummy } This would get recognized by the lazy loader and it would properly copy/clone the variable. We MUST copy the namespace variables as some packages uses them to remember some state. So it is absolutely crucial. The introspective loader does not care much (it is dumb); if the variable is there (info vars) it gets copied, regardles how the var got there. In a sense, the ttrace (lazyloader) is more appropriate for such things as you can really tell him (with [variable]) that it needs to be copied since it is a namespace variable whereas other (possibly just junk) vars need not. Hope this makes sense... Cheers Zoran ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel