> I would bet that if one can detect stack overflows reliably, then one > can also implement an algorithm to safely extend the stack. It might > have other performance impacts though. > > To sum up, I still do not see any technical reason for not being able to > detect stack overflow other than management goals in the implementation > of Tcl and the one possibly technical goal of trading off a level of > safety vs. a level of performance.
See my previous post - Tcl already has a place for this. It's doing it "reliably". If people are interested in testing implementations, there is a place to do it: tcl/unix/tclUnixInit.c:TclpCheckStackSpace. It could be some combination of alloca and a STACK_THRESHHOLD. In any case, it is highly likely that Tcl will be moving to a new non-recursive stack engine in the byte-code compiler for 8.5 (which can be found in mod-core-8-3-4-branch). This should also help alleviate the stack problem. Jeff
