\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#131: Read My Mind and Do What I Mean}
\date{April 01, 2003}
\author{Joe English}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#131}&\textbf{Read My Mind and Do What I Mean}\\\hline
Author&

Joe English \tipmail{jenglish}{flightlab.com}
\\
Created&Tuesday, \(\text{1}^{\text{st}}\) April 2003\\
Type&Project\\
Tcl Version&\(8.5\)\\
State&Draft\\
Vote&No voting\\
Version&\tipversion$Revision: 1.2 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

A new Tcl command is proposed, \textit{rmmadwim}. This is an acronym for ``Read My Mind and Do What I Mean\(''\). This command has obvious utility.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Specification}

The \textit{rmmadwim} command shall take no arguments. When invoked, the Tcl interpreter shall read the programmer's mind and do what he or she intends.

\textit{NOTE:} It is very important that \textit{rmmadwim} read the \textit{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 \textit{expr} which applies the same principles to general mathematical computation:
\begingroup\small\begin{verbatim}
  set result [expr {rmmadwim()}]
\end{verbatim}
\endgroup

This extra functionality is easy to enable:
\begingroup\small\begin{verbatim}
  rmmadwim
\end{verbatim}
\endgroup

\section{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 \textit{rmmadwim} command would provide a powerful enough incentive that even Perl programmers would be compelled to switch languages.

\section{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: \textit{tcl/generic/tclCmdMZ.c}

Function: \textit{Tcl\_RmmAndDWIMObjCmd}
\begingroup\small\begin{verbatim}
       /*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;
   }
\end{verbatim}
\endgroup

\section{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:
\begingroup\small\begin{verbatim}
   #
   # Query the programmer's mind to obtain his or her
   # P3P settings (See "Platform for Privacy Preferences",
   # <URL: http://www.w3.org/P3P >)
   #
       rmmadwim

   #
   # Disable any internal commands that are in conflict
   # with those settings:
   #
       rmmadwim
\end{verbatim}
\endgroup

In addition, the Tcl release notes should give a clear indication to programmers about the new security implications for non-Safe interpreters.

\section{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.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
