This is not necessarily the current version of this TIP.
This proposal has no content. It exists only to provide a document on which testing of and practice using of the TIP editing interfaces can take place.
...edits through the web.
This document has been placed in the public domain.
Currently, once the evaluation of a script has been initiated it will do one of the following:
run to completion,
run until it encounters an uncaught error,
run until it exceeds a pre-determined limit as specified in TIP #143,
or run indefinitely.
In the final case above, neither the host application nor an interactive user have any recourse to terminate the script.
There are many situations for which it is absolutely necessary to be able to cancel a running script without its cooperation and without setting an arbitrary limit on the amount of time it can run (TIP #143). This is especially true in a multi-threaded application embedding environment, or where a user interface is present.
In the case where the completion time for a script is unknown, non-existant, or non-deterministic a user may want or need to terminate the script prematurely.
When evaluating an untrusted - or marginally trusted - script in either a safe or standard interpreter, there is a risk that the script might never terminate. In such a situation it is not reasonable to forcibly terminate the thread or the entire process.
Forcibly terminating a thread prevents Tcl and Tk from cleaning up their thread-specific memory and resources.
The host application may suffer similar memory and resource leaks as well as other serious side-effects that may corrupt data, prevent other threads from properly synchronizing, or leave the process in an unknown and unrecoverable state.
For an interactive host application valuable work may be lost without providing an opportunity to save pending modifications. Even in the absence of modifications the host application might have been holding locks that left unreleased would prevent other processes and users from using important resources.
The basic building blocks needed for any scripting language to seamlessly integrate with an enterprise-ready host application are:
Engine Initialization
Evaluation
Extensibility
Cancellation
Engine Finalization
Tcl now provides full support for all of the above except script cancellation. TIP #143 allows for scripts to be prematurely terminated after reaching resource limits that were pre-arranged by the host application. However, this only handles terminating scripts based on a narrow set of deterministic criteria. Full support would require the ability to immediately and unconditionally terminate the evaluation of a script without adversely affecting the execution environment of the host application. In addition the following issues must be addressed:
Scripts being evaluated in nested slave interpreters.
Interaction with third-party extensions.
Safely useable by abitrary threads.
Several other mainstream scripting engines currently provide this capability to cancel the evaluation of a script. This TIP proposes an implementation that would bring this necessary aspect of application integration to Tcl. This must be implemented in the core, because access to and modification of internal Tcl functions and data structures is required.
This is not necessarily the current version of this TIP.