On 11/21/2012 06:45 PM, Damon Courtney wrote:
If we end up relying on the autoloader, which we do a little bit now,
we can very easily replace the Tcl version with our own once the Tcl
guys decide to ship without one.  I wouldn't expect that release any
time before 2020 though.  In the meantime, just use the one Tcl has
had for years.  It's already well known and people now how to use it.
Well, Tcl people at least.

Tcl's autoloader is all done in the ::unknown command, so it's really
nothing more than creating our own.  We can even create it in the
::request namespace so as not to interfere with the global unknown,
but I generally would just do it at the global scope.


we do have scripts running at the global scope (e.g. every initialization script) where is natural to load packages that are guaranteed to be there as long as the interpreter exists. It seems to me the most sensible approach


I guess SeparateVirtualInterps was introduced exactly for this
purpose.

Not really, no.  I am of the opinion that SeparateVirtualInterps
should always be on by default.  I'm not sure WHY we didn't make it
so when we built Rivet a decade ago, but that is my feeling today.

The thing is, even if you're NOT a hosting company, you REALLY want
separate interps for all of your sites.  I'm a poor developer (not
really, but I'm cheap), so I run all my instances on the same server.
I have a dev.server.com and www.server.com all running in the same
Apache server.  I don't want the code of those servers getting mixed
up.  EVER.  So I want a separate interp for each host.  I actually
run multiple websites off the same server / Apache instance, and
despite the fact that some of them might share code, I don't want any
of them bumping into each other.  I think that is most people.
Having everything in a single interp causes more problems for
beginners, I think, because they don't understand what is going on.
I myself have been bitten by this.


I think we all using SeparateVirtualInterps we do it exactly for this purpose.

The thing is, even with separate interps turned on, Rivet is no good
for a traditional sort of hosting company where everyone shares a web
server.  Tcl (and Rivet by extension) allows too many commands to get
at the filesystem and other goodies in the OS.  There's no way to
lock that down, which is why NeoWebScript used safe interpreters for
every web request back in the day.  Nowadays, a hosting company would
just give you a virtual machine or a virtual private server and not
worry about it.

I still think the sensible thing is to always use a separate interp
for different virtual hosts, but it would break compatibility now, so
I might just make some note somewhere in the INSTALL docs for the
newbies.

Also, if someone has a good rundown of how you COULD share some
global code (like, say, a framework) between all Apache children and
interps without incurring the overhead of reloading said code
everywhere, that would also be nice in the docs.  Maybe Karl and the
Flightaware guys have some sage advice here.

D

Effects of code run (loaded) in ServerInitScript interp are cloned into the child process interps. SeparateVirtualInterp forces the creation of slave interpreters which don't get those initializations from the master interpreter. I know there are way to remove capabilities from a slave interpreter, I don't know of any method to make the slave creation by the master deep. Thus setting SeparateVirtualInterp loses the initializations and requires packages to be reloaded in each slave

 -- Massimo


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to