- tclsh documentation
- Includes a short description of $::tcl_interactive.
- tclvars documentation
- Includes the same information as the tclsh documentation.
Description editIf the value of $::tcl_interactive is true, the interpreter operates in interactive mode. The behaviour of the interpreter can be toggled between interactive and non-interactve mode by changing the value of $::tcl_interactive. See tclsh for a list of the differences between interactive and non-interactive mode.Ro: You can shorten commands in interactive mode, e.g.: "inf" for "info".RS 2004-03-24: Yup - and this is especially delightful on a PocketPC where less stylus-tapping is better. If the abbreviation is unambiguous, like ll for llength, it saves time and screen space; if it is ambiguous (e.g. 'l'), it is another introspection helper - the educational error message shows you the possible completions, just as info commands l* would have done.
% l ambiguous command name "l": label labelframe lappend lindex linsert list listbox llength load loadvfs lower lrange lreplace lsearch lset lsort % ll wrong # args: should be "llength list"Just make sure that the interactive command is tried at global level (0), so that unknown (which provides abbreviation mode) finds itself at level 1.
If tclsh runs a script given on the command line, $::tcl_interactive is set to false, but adding the line
set ::tcl_interactive 1gives you the described benefits, so I added that to iFile 1.1.DGP: Note this feature is new in Tcl 8.4. Note also that the intended user of this feature is Tcl's test suite. Use with care.JMN 2008: This variable seems to be undefined in new threads created using the Thread package. I suspect this is a bug, as other variables such as $::tcl_patchLevel do exist in new threads. On loading a module into another thread, which uses $::tcl_patchLevel to change its logging behaviour slightly, I get the error:
can't read "::tcl_interactive": no such variable