Skip to content
Tcl Source Code Artifact [b10c851a43]
Login

Artifact [b10c851a43]

Artifact b10c851a4313a0bb6aafc543b12233a800a19905:

Ticket change [b10c851a43] - New ticket [218232ffffffffff|218232ffff] <i>patch to enhance expr expression syntax</i>. by nobody on 2000-10-26 00:54:52.
D 2000-10-26T00:54:52
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2669\sRFE\nVersion:\s8.2\nSubmitDate:\s'1999-08-31'\nLastModified:\s'1999-09-15'\nSeverity:\sSER\nStatus:\sClosed\nSubmitter:\stechsupp\nChangedBy:\shobbs\nOS:\sLinux-Red\sHat\nMachine:\sOther\nFixedDate:\s'2000-10-25'\nClosedDate:\s'1999-09-15'\n\n\nName:\n\nRoger\sE\sCritchlow\sJr\n\n\n\nDesiredBehavior:\n\nMake\sthe\sexpr\scommand\suse\sconventional\svariable\sreference\sand\sfunction\n\n\s\s\s\scall\ssyntax\n\n\s\s\s\sfor\sreferences\sto\sTcl\sscalar\svariables\sand\scalls\sto\sTcl\scommands\sand\n\n\s\s\s\sprocedures\sin\n\n\s\s\s\saddition\sto\sthe\sTcl\smacro/command\ssubstitution\scurrently\simplemented.\n\n\s\s\s\sHence,\n\n\s\s\s\s{expr\sa}\swould\sreturn\sthe\svalue\sof\sthe\sTcl\svariable\snamed\s"a"\sor\sreport\n\n\s\s\s\s"can't\sread\s"a":\n\n\s\s\s\sno\ssuch\svariable",\srather\sthan\sthrowing\sa\ssyntax\serror,\sand\s{expr\n\n\s\s\s\sf(1,2,3)}\swould\n\n\s\s\s\sreturn\sthe\sresult\sof\scalling\s[f\s1\s2\s3]\sor\sreport\s"invalid\scommand\sname:\n\n\s\s\s\s"f"",\srather\sthan\n\n\s\s\s\sthrowing\san\sundefined\smath\sfunction\serror.\s\sThe\sexpr\sparser\sis\senhanced\n\n\s\s\s\sto\saccept\n\n\s\s\s\sidentifiers\swhich\sinclude\sthe\snamespace\sdelimiter.\s\s\sThe\sexisting\sexpr\n\n\s\s\s\ssyntax\sis\n\n\s\s\s\sunaffected\sby\sthis\senhancement,\sand\sexisting\sprograms\swhich\sdo\snot\n\n\s\s\s\sdepend\son\n\n\s\s\s\ssyntax\serrors\sor\sundefined\smath\sfunction\serrors\swill\scontinue\sto\swork\n\n\s\s\s\swithout\s\n\n\s\s\s\smodification.\n\n\s\s\s\s\n\n\s\s\s\sFor\sinstance,\sthe\sfactorial\sfunction\scurrently\swritten\sas:\n\n\s\s\s\s\n\n\s\s\s\sproc\sfactorial\s{n}\s{\sexpr\s{$n>1\s?\s$n*[factorial\s[expr\s{$n-1}]]\s:\s1}\s}\n\n\s\s\s\s\n\n\s\s\s\scan\sbe\swritten\sin\sthe\senhanced\sexpr\sas\ssimply:\n\n\s\s\s\s\n\n\s\s\s\sproc\sfactorial\s{n}\s{\sexpr\sn\s>1\s?\sn*factorial(n-1)\s:\s1}\s}\n\n\s\s\s\s\n\n\s\s\s\seliminating\stwo\squotations,\sthree\sdollars,\sand\sa\snested\scall\sto\sexpr.\n\n\s\s\s\sIt's\n\n\s\s\s\snot\sonly\seasier\sto\sread\sand\swrite,\sit\sevaluates\smore\sefficiently\n\n\s\s\s\sbecause\n\n\s\s\s\snested\scalls\sto\sexpr\sare\sno\slonger\sneeded\sto\spass\scomputed\sarguments.\n\n\s\s\s\s\n\n\s\s\s\sCalls\sto\sTcl\scommands\swhich\stake\sa\svariable\sname\sas\san\sargument\sneed\n\n\s\s\s\sto\squote\sthe\svariable\sname\sif\swritten\sin\senhanced\sexpr\ssyntax.\n\n\s\s\s\s\n\n\s\s\s\sset\sa\s2;\sexpr\sset(a,3)\n\n\s\s\s\s\n\n\s\s\s\screates\sa\svariable\snamed\s"2"\swith\sthe\svalue\s"3",\s\sbut\n\n\s\s\s\s\n\n\s\s\s\sexpr\sset({a},3)\n\n\s\s\s\s\n\n\s\s\s\ssets\sthe\svalue\sof\s"a"\sto\s"3".\s\n\n\s\s\s\s\n\n\s\s\s\sArray\sreferences\sthrough\sthe\senhanced\sexpr\scan\sbe\sdone\sby\swriting\sa\n\n\s\s\s\sfunction\scall\sto\sthe\sarray\sname\swith\sarray\sindex(es)\sas\sargument(s)\sand\n\n\s\s\s\ssupplying\sa\sTcl\sprocedure\sof\sthe\ssame\sname\swhich\sconstructs\sa\sTcl\sarray\n\n\s\s\s\sreference.\s\sThis\sisn't\sthe\sgreatest\ssolution,\sbut\sit\sat\sleast\sallows\n\n\s\s\s\sreferences\n\n\s\s\s\sto\scomputed\sarray\sindexes,\seg\sa(i+1),\swithout\snested\scalls\sto\sexpr.\n\n\s\s\s\s\n\n\s\s\s\sThe\spatches\sto\simplement\sthis\senhancement\scome\sto\s294\slines\sin\sdiff\s-r\n\n\s\s\s\s-c\sformat,\sconfined\sto\stclParseExpr.c\sand\stclCompExpr.c\n\n\n\nPatch:\n\nhttp://www.elf.org/pub/tcl8.2.0-expr.patch\n\n\n\nPatchFiles:\n\ntclCompExpr.c\n\n\s\s\s\stclParseExpr.c\n\n\n\n\n\nThe\snewsgroup\spointed\sout\sseveral\scompatability\swith\sthis\sidea.\s\n--\s09/15/1999\shobbs
J foundin obsolete:\s8.2
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title patch\sto\senhance\sexpr\sexpression\ssyntax
J type RFE
K 218232ffffffffffffffffffffffffffffffffff
U nobody
Z f4b143af96594c855123bfcc74f68f82