Version 2 of Script substitution

Updated 2019-02-12 17:34:41 by pooryorick

Script Substitution is the more apt term for Command Substitution, since entire scripts, not just individual commands, can be contained in brackets. The result of the script is the result of the final command. A new stack frame is not created, so using return or break or the like will cause the caller to return, etc.

Recursion

PYK 2019-02-12: Script substitution can be recursive. Everything happens at the same level, as no additional levles are created:

puts [
    set n 10
    set a {
        puts $n
        expr {[incr n -1]? [try $a] : {liftoff}}
    }
    try $a
]