summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdIL.c
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2014-08-01 16:34:11 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2014-08-01 16:34:11 (GMT)
commit28c803e0587a6f34716420ed9a3e63dea93b2255 (patch)
treeb111aed5eb37ab357fc42b097745869da90c996a /generic/tclCmdIL.c
parent5d6c006a2ce1195737c5d8ce05d7b53e41389005 (diff)
downloadtcl-tip429_only_id.zip
tcl-tip429_only_id.tar.gz
tcl-tip429_only_id.tar.bz2
Recognize that "id" is the K combinator in disguise. Rename it as "K" and extend its semantics accordingly.tip429_only_id
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r--generic/tclCmdIL.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index ec6ad14..8b4b859 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -191,14 +191,13 @@ static const EnsembleImplMap defaultInfoMap[] = {
/*
*----------------------------------------------------------------------
*
- * Tcl_IdObjCmd --
+ * Tcl_KObjCmd --
*
- * This procedure is invoked to process the "id" Tcl command. See the
+ * This procedure is invoked to process the "K" Tcl command. See the
* user documentation for details on what it does.
*
- * With the bytecode compiler, this procedure is only called in case of
- * wrong #args, or if the #args is not known at compile time (expand
- * operator).
+ * With the bytecode compiler, this procedure is only called when the
+ * #args is not known at compile time (expand operator).
*
* Results:
* A standard Tcl result.
@@ -210,17 +209,20 @@ static const EnsembleImplMap defaultInfoMap[] = {
*/
int
-Tcl_IdObjCmd(
+Tcl_KObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- if (objc !=2) {
- Tcl_WrongNumArgs(interp, 0, objv, "id value");
- return TCL_ERROR;
+ if (objc>=2) {
+ Tcl_SetObjResult(interp, objv[1]);
+ } else {
+ Tcl_Obj *empty;
+
+ TclNewObj(empty);
+ Tcl_SetObjResult(interp, empty);
}
- Tcl_SetObjResult(interp, objv[1]);
return TCL_OK;
}