Skip to content
Tcl Source Code History Of Ticket 218232
Login

History Of Ticket 218232

Artifacts Associated With Ticket 218232

  1. Ticket change [b10c851a43] (rid 98085) by nobody on 2000-10-26 00:54:52:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. 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
      
    4. foundin initialized to: "obsolete: 8.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "patch to enhance expr expression syntax"
    11. type initialized to: "RFE"
  2. Ticket change [fda6a89fab] (rid 108440) by welch on 2000-10-26 08:17:54:

    1. closedate changed to: "2000-10-26T01:17:54"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [6b4e2242b4] (rid 128305) by dgp on 2001-04-19 00:47:37:

    1. foundin changed to: "None"
    2. status changed to: "Open"
    3. subsystem changed to: "None"
  4. Ticket change [45ddab0ec0] (rid 99415) by dgp on 2001-04-19 00:48:47:

    1. closedate changed to: "2001-04-18T17:48:47"
    2. closer changed to: "dgp"
    3. status changed to: "Deleted"
    4. subsystem changed to: "16. Commands A-H"