On Thursday, September 20, 2001, at 09:46 AM, Jim Wilcoxson wrote:

> Seems like some kind of dynamic proc definition mechanism similar to
> autoloading would be useful here...

I was just reading the Ousterhout book on the unknown command and
autoloading.  I don't think the default Tcl autoloading mechanism is
appropriate, because it depends on building an index file on disk, but I
think it might be useful to create an AOLserver-specific unknown command,
and perhaps redefine "proc" so that AOLserver stores the proc defs in a
hash; then, when an unknown command is invoked, the AOLserver-specific
unknown command could grab the def from the hash and eval it, and then
execute the command.

One issue I'm concerned about here is the overhead of such an approach --
the first time through an interpreter, you could be hitting the unknown
command a lot, and it could be really slow.  On the other hand, maybe it
wouldn't be any slower than eval'ing a big script of all the procs.

Jim, do you know if it's the interp startup script that's taking the time
in your application?

I was also thinking it would be useful if we could have some form of
shared libraries for Tcl, so that a compiled proc could be shared among
interpreters.  This would improve memory footprint, and might help reduce
interp startup time.  Does anyone know if modern Tcl supports sharing
compiled procs?  It didn't seem to as of 8.3, but I could be misreading
the docs.

Reply via email to