diff --git a/src/modules/punk-0.1.tm b/src/modules/punk-0.1.tm index 5d72263..8126b31 100644 --- a/src/modules/punk-0.1.tm +++ b/src/modules/punk-0.1.tm @@ -1481,6 +1481,14 @@ namespace eval punk { } set cmdline_result [uplevel 1 [concat $rhs $segment_members_filled]] set d [_multi_bind_result $returnvarspec [punk::K $cmdline_result [unset cmdline_result]]] + + #multi_bind_result needs to return a funcl for rhs of: + #lindex [list [set syncvar [main pipeline.. ]] [rhs binding funcl...] 1 ] + #which uses syncvar + # + #The lhs of 'list' runs first so now syncvar can be the root level of the rhs function list and bind the necessary vars. + #NOTE: unintuitively, we are returning the value of rhs to the main pipleline! (leftmost binding) this is because the leftmost binding determines what goes back to the pipeline result + set r [_handle_bind_result $d] set segment_result $r } @@ -1829,7 +1837,9 @@ namespace eval punk { } - proc pipeswitch {pipescript} { + proc pipeswitch {pipescript args} { + set prefix "set args \[list $args\]\n" + set pipescript $prefix$pipescript uplevel 1 [list if 1 $pipescript] } proc ansi+ {args} { @@ -2185,7 +2195,7 @@ namespace eval punk { lappend chunklist [list result $result] set ::punk::last_run_display $chunklist if {$::repl::running} { - repl::term::term::set_console_title $result + repl::term::set_console_title $result } return $result }