Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9647faa9f3e24cd2e46744d02a79b53f124b1aa3
Ticket: 219376ffffffffffffffffffffffffffffffffff
Pass result of last command in for, foreach, and while
User & Date: nobody on 2000-10-26 05:11:50
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 6006 RFE
    Version: 8.4a1
    SubmitDate: '2000-07-12'
    LastModified: '2000-10-25'
    Severity: LOW
    Status: UnAssn
    Submitter: techsupp
    OS: All
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Name:
    Philip Moore
    
    Comments:
    Then here's some TCL code to try to explain (if you don't already
        understand what I'm saying):
    
        It would be extremely handy if I could do this:
    
        if {[foreach a "a b c d" { do whatever stuff on $a and $arg here }] ==
        "c"} { }
    
        That would save me from having to do all this:
    
        if {"[mycommand $arg]" == "c"} { }
    
        proc mycommand {arg} {
          foreach a "a b c d" { do whatever stuff on $a and $arg here } 
          return $result 
        }
    
        Also, if for, foreach, and while returned the results of the last thing
        inside them you could have a proc like this:
    
        proc someproc {arg} {
           for {set x 0} {$x<$arg} {incr x} {
             lappend out "x is $x"
           }
        }
    
        Instead of having this:
    
        proc someproc {arg} {
           for {set x 0} {$x<$arg} {incr x} {
             lappend out "x is $x"
           }
           set out
        }
    
        I know my examples were kinda poor.. But they should have gotten my
        point across.. 
        And before somebody says this is a bad idea.. I have to say this..
        proc's themselves already return the results of the last command, so why
        can't for, foreach, and while?
    
        -Philip Moore 
        [email protected]
    
        p.s.
        Please CC any replies to [email protected] as I don't have access to
        the newsgroup.
    
    DesiredBehavior:
    The commands for, foreach, and while don't pass the results of the last command inside them.. It'd be nice, I think, if they did.. (Currently, they always return "")
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.4a1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to:
    New Feature Request: Pass the results of the last command in
    
  11. type changed to: "RFE"