<i>expr cannot call math functions named eq/ne/in/ni or starting with them (in_range, eq_zero, ...)</i>.
by
.
D 2026-10-17T10:51:11.860
J cmimetype text/x-fossil-wiki
J comment A\smath\sfunction\swhose\sname\sis\sa\sword\soperator,\sor\sstarts\swith\sone\sfollowed\sby\sa\snon-letter,\ncannot\sbe\scalled\sfrom\s<nowiki>[expr]</nowiki>,\salthough\smathfunc(n)\ssays\sthat\sany\scommand\ndefined\sin\s<tt>tcl::mathfunc</tt>\sbecomes\sa\sfunction:\n\n<verbatim>\nproc\stcl::mathfunc::in_range\s{x\slo\shi}\s{expr\s{$lo\s<=\s$x\s&&\s$x\s<=\s$hi}}\nproc\stcl::mathfunc::eq\s{x}\s{return\s$x}\nexpr\s{in_range(5,\s1,\s10)}\nexpr\s{eq(1)}\n</verbatim>\n\nBoth\sfail\swith\s<tt>missing\soperand</tt>,\se.g.\n\n<verbatim>\nmissing\soperand\sat\s_@_\nin\sexpression\s"_@_in_range(5,\s1,\s10)"\n</verbatim>\n\nExpected:\s<tt>1</tt>\sand\s<tt>1</tt>,\sas\sfor\sany\sother\sfunction\sname\n(<tt>inrange(5,\s1,\s10)</tt>\sworks).\n\nAffected\snames:\s<tt>eq</tt>,\s<tt>ne</tt>,\s<tt>in</tt>,\s<tt>ni</tt>,\sand\ssince\s9.0\s(TIP\s461)\nalso\s<tt>lt</tt>,\s<tt>le</tt>,\s<tt>gt</tt>,\s<tt>ge</tt>,\salone\sor\sfollowed\sby\sa\sdigit\sor\san\nunderscore\s(<tt>in_range</tt>,\s<tt>eq_zero</tt>,\s<tt>in1</tt>,\n<tt>lt_x</tt>,\s...).\s<tt>lt_x(1)</tt>\sworks\sin\s8.6\sand\sfails\sin\s9.0.\n\nCause:\s<tt>ParseLexeme</tt>\sin\sgeneric/tclCompExpr.c\sreturns\s<tt>STREQ</tt>,\n<tt>IN_LIST</tt>\setc.\swhenever\sthe\sthird\scharacter\sis\snot\san\sASCII\sletter,\swithout\sregard\sto\ncontext;\s<tt>ParseExpr</tt>\sonly\sturns\sa\s<tt>BAREWORD</tt>\sfollowed\sby\s<tt>(</tt>\sinto\sa\n<tt>FUNCTION</tt>.\sTwo\spossible\sfixes:\sin\s<tt>ParseExpr</tt>,\streat\sa\sword\soperator\sthat\nappears\swhere\san\soperand\sis\sexpected\sand\sis\sfollowed\sby\s<tt>(</tt>\sas\sa\sfunction\sname\s(a\sbinary\noperator\sis\salways\san\serror\sthere,\sso\sthis\sis\sunambiguous);\sand\sin\s<tt>ParseLexeme</tt>,\sdo\snot\nend\sthe\soperator\sat\s<tt>_</tt>\s(<nowiki>[expr\s{$a\seq_1}]</nowiki>\sis\san\serror\sanyway).\sDigits\nare\sambiguous,\ssince\s<nowiki>[expr\s{$a\seq1}]</nowiki>\scurrently\smeans\s<tt>$a\seq\s1</tt>.\n\nHistory:\s[ced7ccb24b]\s(2005,\s[1201589fff])\smade\sthe\sold\sparser\saccept\s<tt>eq</tt>,\n<tt>ne</tt>,\s<tt>in</tt>,\s<tt>ni</tt>\sas\sfunction\snames\sin\soperand\sposition.\sThe\snew\sparser\nin\s8.5a5\s(2006;\sold\sparser\sdropped\sin\s[877cacc543])\sdoes\snot,\sso\sno\s8.5\sor\slater\srelease\nhas\ssupported\sit.\s8.4.20\srejects\s<tt>eq(1)</tt>\stoo\s(<tt>unexpected\soperator\seq</tt>).\sA\nsimilar\sproblem\sfor\snames\sstarting\swith\sa\snumber\s(<tt>nancy</tt>)\swas\s[3401704fff].
J foundin 8.6.18,\s9.0.5,\s9.1.0
J login serhiy.storchaka
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J subsystem 45.\sParsing\sand\sEval
J title expr\scannot\scall\smath\sfunctions\snamed\seq/ne/in/ni\sor\sstarting\swith\sthem\s(in_range,\seq_zero,\s...)
J type Bug
K 1e66ba3d490260713811edff4722fc1bfa1b4547
U serhiy.storchaka
Z 193219259873ed438a95e0c858d34764