On Fri, 1 Feb 2019 09:59:09 -0500 Andrew Piskorski <a...@piskorski.com> wrote:
> So they do the exact same thing, and are completely interoperable? > Meaning I can have C and Tcl talk to each other via Ns_Var* in C and > nsv_* in Tcl? Great! Yes. > > I'm a little confused by (e.g.) Ns_VarGet(), though. Why is its first > arg a string for the "server"? What does that mean, and where am I > supposed to get it from? This is the identification of the Naviserver's virtual server that is implicitly "known" to the Tcl code. The nsv_XXX is thus bound to a virtual server since your Tcl code executes within a specific virtual server. But on the C-level you need to specify the virtual server explicitly because your C code may operate for all known virtual servers or just bunch of them. > > Also, why are NsTclNsvGetObjCmd() and Ns_VarGet() > implemented independently, rather than NsTclNsvGetObjCmd() calling > Ns_VarGet()? I assume there's some good reason for this, but I'd like > to understand what it is... Well, simplicity, that is. In essence, one could have done that but it would be more complicated. The former operates mainly with Tcl objects from within one Tcl script whereas the latter is mainly (supposed to be) used from C code that has no relation to any Tcl interp/script. If you compare the guts of both calls you will see something like LockArray/CreateHashEntry which is what "counts". Everything else is glue. HTH, Zoran _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel