On 16.04.2006, at 19:20, Vlad Seryakov wrote:
Using Ns_Tls in C looks very usafull, why not having the same in
Tcl as well?
I belive what you did not "sell" correctly is the ability
to have C and Tcl interface to same data in a "simple" manner.
Because in my eyes, this is the major "pro".
Normally, I would not buy ns_tls interface if it were just
a replacement for setting a global variable in Tcl. Because
you can very simply setup a tiny Tcl wrapper:
proc ns_tls_set {key val}
set private::tls($key) $val
}
proc ns_tls_get {key}
set private::tls($key)
}
(add some more simple code if you'd be using
[interp create] or such...)
But the fact that you can access the same things
from C code makes ns_tls worth considering (still, you need
to have some conventions in place about data-types...)
A good example of this dual interface is ns_config.
It can be used from C and Tcl, which is why I was contemplating
of adding more features there (perhaps allowing read/write operations
after server startup).
I haven't check the implementation but you need to be careful
if you plan to store Tcl_Obj's references there. I can't recall eactly
but there might be problems when you make some Tcl_Obj's jump the
interpreters...
Cheers
Zoran