Read My Mind and Do What I MeanJoe English$Revision: 1.2 $
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.
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:
ICBzZXQgcmVzdWx0IFtleHByIHtybW1hZHdpbSgpfV0=
This extra functionality is easy to enable:
ICBybW1hZHdpbQ==
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.
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
ICAgICAgIC8qQVJHU1VTRUQqLw==ICAgaW50ICAgVGNsX1JtbUFuZERXSU1PYmpDbWQoZHVtbXksIGludGVycCwgb2JqYywgb2Jqdik=ICAgICAgIENsaWVudERhdGEgZHVtbXk7ICAgICAgICAgICAgICAgICAgIC8qIE5vdCB1c2VkLiAqLw==ICAgICAgIFRjbF9JbnRlcnAgKmludGVycDsgICAgICAgICAgICAgICAgIC8qIEN1cnJlbnQgaW50ZXJwcmV0ZXIuICovICAgICAgIGludCBvYmpjOyAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qIE51bWJlciBvZiBhcmd1bWVudHMuICovICAgICAgIFRjbF9PYmogKkNPTlNUIG9ianZbXTsgICAgICAgICAgICAgIC8qIEFyZ3VtZW50IG9iamVjdHMuICovICAgew==ICAgICAgIGludCBzdGF0dXM7ICAgICAgIFRjbF9PYmogKmludGVudGlvbnM7ICAgICAgIGlmIChvYmpjICE9IDEpIHs=ICAgICAgICAgICBUY2xfV3JvbmdOdW1BcmdzKGludGVycCwgMSwgb2JqdiwgTlVMTCk7ICAgICAgICAgICByZXR1cm4gVENMX0VSUk9SOw==ICAgICAgIH0=ICAgICAgIHN0YXR1cyA9IFRjbFJlYWRQcm9ncmFtbWVyc01pbmQoaW50ZXJwLCAmaW50ZW50aW9ucyk7ICAgICAgIGlmIChzdGF0dXMgIT0gVENMX09LKSB7ICAgICAgICAgICByZXR1cm4gc3RhdHVzOw==ICAgICAgIH0=ICAgICAgIHN0YXR1cyA9IFRjbERvV2hhdElzTWVhbnQoaW50ZXJwLCBpbnRlbnRpb25zKTs=ICAgICAgIHJldHVybiBzdGF0dXM7ICAgfQ==
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:
ICAgIw==ICAgIyBRdWVyeSB0aGUgcHJvZ3JhbW1lcidzIG1pbmQgdG8gb2J0YWluIGhpcyBvciBoZXI=ICAgIyBQM1Agc2V0dGluZ3MgKFNlZSAiUGxhdGZvcm0gZm9yIFByaXZhY3kgUHJlZmVyZW5jZXMiLA==ICAgIyA8VVJMOiBodHRwOi8vd3d3LnczLm9yZy9QM1AgPik=ICAgIw==ICAgICAgIHJtbWFkd2ltICAgIw==ICAgIyBEaXNhYmxlIGFueSBpbnRlcm5hbCBjb21tYW5kcyB0aGF0IGFyZSBpbiBjb25mbGljdA==ICAgIyB3aXRoIHRob3NlIHNldHRpbmdzOg==ICAgIw==ICAgICAgIHJtbWFkd2lt
In addition, the Tcl release notes should give a clear indication to programmers about the new security implications for non-Safe interpreters.
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.