On 3/6/07, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:
Am 06.03.2007 um 15:35 schrieb Stephen Deasey: > > How does the lazy loader compare to Tcl's -lazy switch to pkg_mkIndex? > > http://www.tcl.tk/man/tcl8.4/TclCmd/pkgMkIndex.htm I have absolutely no idea. Our lazy-loader depends on the command trace utility. I yet have to see what pkgindex is using. Overall, I still think that using ns_ictl is the real solution to interp init problem. Perhaps not the fastest but most definietly the most flexible and universal one. Simply, we'd collect list of all files we'd need to source and just register callback's to run them at interp init. This is trivially implemented and would IMHO run more/less at the same speed but be more generic and foolproof. It would not save us memory as the lazy loader does, but it would be more generic.
OK. A single, simple way for modules to initialise themselves. Re the laz-loading, the difference seems to be: our tracing lazy loader works on a per-proc (or other Tcl object) level, and it tries to be transparent to the user; whereas the Tcl pkgIndex mechanism works at the file level, and you explicitly hook into this (although you can automate it). I wasn't really interested in the laziness of the loading, but the searching and packaging and other funky stuff you have to be aware of just to get some code loaded. So, how about we make NaviServer modules a super set of Tcl packages? The only difference I think we need is that a naviserver module (a package) should register a config callback when it is 'package require'd, which will get called once for each time the module/package name appears in the ns/server/serverx/modules section. Loading modules then becomes a 'package require modulex' (which will be cached by Tcl) and then a series of calls to the registered module config callback, i.e. if you load the nssock module twice, sock1 and sock2 to listen on different ports. What do y'all think, NaviServer modules == Tcl packages..? I've been experimenting a little with this. Attached is what a pkgIndex.tcl file might look like for the nsd package. Ultimately, I guess we could turn the server inside-out. /usr/sbin/nsd would become a script which package requires nsd. Just need to turn the stuff in nsd/nsmain.c etc. into commands...
pkgIndex.tcl.in
Description: Binary data
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel