TIP #131: READ MY MIND AND DO WHAT I MEAN =========================================== Version: $Revision: 1.2 $ Author: Joe English State: Draft Type: Project Tcl-Version: 8.5 Vote: No voting Created: Tuesday, 01 April 2003 URL: https://tip.tcl-lang.org131.html Post-History: ------------------------------------------------------------------------- ABSTRACT ========== A new Tcl command is proposed, /rmmadwim/. This is an acronym for ``Read My Mind and Do What I Mean/. This command has obvious utility. SPECIFICATION =============== The /rmmadwim/ command shall take no arguments. When invoked, the Tcl interpreter shall read the programmer's mind and do what he or she intends. /NOTE:/ It is very important that /rmmadwim/ read the /programmer's/ mind, not the end user's. Otherwise the consequences could be disastrous, since end users rarely have a firm grasp of what the original programmer was up to. As a consequence of this command, there is also a corresponding function for /expr/ which applies the same principles to general mathematical computation: set result [expr {rmmadwim()}] This extra functionality is easy to enable: rmmadwim RATIONALE =========== What Tcl needs in order to succeed in the marketplace is a feature that no other programming language provides, a "killer app" as it were. The Tk toolkit, Expect, cross-platform portability, scripted documents, tkcon, and the [incr Tcl] "toaster" example are all well and good, but they have clearly failed to push Tcl usage to the point of having critical mass. The /rmmadwim/ command would provide a powerful enough incentive that even Perl programmers would be compelled to switch languages. REFERENCE IMPLEMENTATION ========================== A skeletal implementation is included below. Clearly some of the details remain to be flushed out, but this is a simple matter of programming (SMOP). It should be a fun weekend project for Richard Suchenwirth. File: /tcl/generic/tclCmdMZ.c/ Function: /Tcl_RmmAndDWIMObjCmd/ /*ARGSUSED*/ int Tcl_RmmAndDWIMObjCmd(dummy, interp, objc, objv) ClientData dummy; /* Not used. */ Tcl_Interp *interp; /* Current interpreter. */ int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { int status; Tcl_Obj *intentions; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } status = TclReadProgrammersMind(interp, &intentions); if (status != TCL_OK) { return status; } status = TclDoWhatIsMeant(interp, intentions); return status; } SECURITY IMPLICATIONS ======================= It was pointed out that the ability to read the programmers' mind carries with it certain security and privacy implementations. To address this, the following code should be executed whenever a safe interpreter is created: # # Query the programmer's mind to obtain his or her # P3P settings (See "Platform for Privacy Preferences", # ) # rmmadwim # # Disable any internal commands that are in conflict # with those settings: # rmmadwim In addition, the Tcl release notes should give a clear indication to programmers about the new security implications for non-Safe interpreters. COPYRIGHT =========== This TIP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License; either version 2 of the License, or (at Richard Stallman's discretion), any later version. Just kidding. Public domain, as usual. ------------------------------------------------------------------------- TIP AutoGenerator - written by Donal K. Fellows