Artifacts Associated With Ticket 218232ffffffffff
Ticket change [b10c851a43] (rid 98085) by nobody on 2000-10-26 00:54:52:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2669 RFE Version: 8.2 SubmitDate: '1999-08-31' LastModified: '1999-09-15' Severity: SER Status: Closed Submitter: techsupp ChangedBy: hobbs OS: Linux-Red Hat Machine: Other FixedDate: '2000-10-25' ClosedDate: '1999-09-15' Name: Roger E Critchlow Jr DesiredBehavior: Make the expr command use conventional variable reference and function call syntax for references to Tcl scalar variables and calls to Tcl commands and procedures in addition to the Tcl macro/command substitution currently implemented. Hence, {expr a} would return the value of the Tcl variable named "a" or report "can't read "a": no such variable", rather than throwing a syntax error, and {expr f(1,2,3)} would return the result of calling [f 1 2 3] or report "invalid command name: "f"", rather than throwing an undefined math function error. The expr parser is enhanced to accept identifiers which include the namespace delimiter. The existing expr syntax is unaffected by this enhancement, and existing programs which do not depend on syntax errors or undefined math function errors will continue to work without modification. For instance, the factorial function currently written as: proc factorial {n} { expr {$n>1 ? $n*[factorial [expr {$n-1}]] : 1} } can be written in the enhanced expr as simply: proc factorial {n} { expr n >1 ? n*factorial(n-1) : 1} } eliminating two quotations, three dollars, and a nested call to expr. It's not only easier to read and write, it evaluates more efficiently because nested calls to expr are no longer needed to pass computed arguments. Calls to Tcl commands which take a variable name as an argument need to quote the variable name if written in enhanced expr syntax. set a 2; expr set(a,3) creates a variable named "2" with the value "3", but expr set({a},3) sets the value of "a" to "3". Array references through the enhanced expr can be done by writing a function call to the array name with array index(es) as argument(s) and supplying a Tcl procedure of the same name which constructs a Tcl array reference. This isn't the greatest solution, but it at least allows references to computed array indexes, eg a(i+1), without nested calls to expr. The patches to implement this enhancement come to 294 lines in diff -r -c format, confined to tclParseExpr.c and tclCompExpr.c Patch: http://www.elf.org/pub/tcl8.2.0-expr.patch PatchFiles: tclCompExpr.c tclParseExpr.c The newsgroup pointed out several compatability with this idea. -- 09/15/1999 hobbs - foundin initialized to: "obsolete: 8.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "patch to enhance expr expression syntax"
- type initialized to: "RFE"
Ticket change [fda6a89fab] (rid 108440) by welch on 2000-10-26 08:17:54:
- closedate changed to: "2000-10-26T01:17:54"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [6b4e2242b4] (rid 128305) by dgp on 2001-04-19 00:47:37:
- foundin changed to: "None"
- status changed to: "Open"
- subsystem changed to: "None"
Ticket change [45ddab0ec0] (rid 99415) by dgp on 2001-04-19 00:48:47:
- closedate changed to: "2001-04-18T17:48:47"
- closer changed to: "dgp"
- status changed to: "Deleted"
- subsystem changed to: "16. Commands A-H"