> Yeah, although we have 100K+ lines of TCL code with ns_shares. It > wouldn't matter much whether nsv's were 100x faster - it isn't a > worthwhile risk for examining and changing that many lines of code. > On top of that, nsv is a broken programming paradigm IMO: source > changes are required for every variable reference, which is a total > PITA. > > I understand it was easier to implement shares this way; that doesn't > mean it is necessarily better, esp considering the history of ns_shares > and their use as true TCL variables.
Although I could never leave tcl8.x (non-greedy regex, expanded foreach syntax, extra string commands, binary data, other stuff) I do wish nsv's were a little more tcl compliant. I can not comment on the internals, but there are a couple of interface methods that might make some sense: upvar #share varname global share:varname geez, even the old ns_share syntax was OK. The point being, if I had a method to bring one of the shared variables into the current context, like ns_share did, then all other procedures downstream could be blissfully unaware if they were shared or not. Although that begs the question of what to do about locking, etc. I've gotten somewhat used to passing -nsv 1 or -nsv 0 when needed, and I made the switch to 8.x pretty early on, so it's not a huge priority to me now. Jim, for what it's worth, while I was porting, I took my time by making my own cheesy ns_share that broght nsv's into the current context. It was read-only though (it just made a copy of it, something like "array set myvar [nsv_array get myvar]" for arrays and "set myvar [nsv_get . myvar]" for single-element items. The performance sucked big-time but it let me switch to AOLServer 3.0 and take a couple of days to port everything. The list handling was another problem, like you mentioned, mostly due to my bad habits. Like doing stuff like "if [llength $var]" to see if something was "blank". This breaks if $var has an unclosed brace, bracket, quotation mark, etc. I ended up making corresponding C-modules to replace some of my 7.6-isms. Rusty
