Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 28a5490a536429f5acdbe4de9e5440189379853a
Ticket: 219376ffffffffffffffffffffffffffffffffff
Pass result of last command in for, foreach, and while
User & Date: dkf on 2000-11-22 23:45:58
Changes

  1. foundin changed to: "obsolete: 8.4a3"
  2. icomment:
    Speaking as an old functional programmer, it would be very nice if the [if] command returned the result of the last command of whatever body it ends up executing.
    I'm less sure about returning values from [for], [foreach] and [while] since the cost of constructing the natural results of those commands (which is the list of the results of the last command of their bodies from each execution) is likely to be very expensive to compute in terms of memory.  Returning the value from the final execution of a loop body doesn't seem very intuitive to me...
    Not that any of this should be taken as being against defining a separate command with the semantics described, since that would be an "opt-in" as opposed to "forced-upon"; i.e. people would use it where it makes sense according to the algorithm being implemented, and not otherwise.  (For example, a collecting [foreach] command is more commonly known as [map] in the functional-programming community.)
    
    
  3. login: "dkf"
  4. mimetype: "text/plain"
  5. username: "dkf"