When using the -S parameter for functions to disabled scope-shadowing, naming conflicts can occur. As a more robust alternative, a mechanism like tcl's upvar would be useful, presumably implemented as option to the set builtin.
Reproduction steps
Create the following fish script file:
#!/usr/bin/env fish
function append -S -a var item
set $var $$var $item
end
set x xx; append x xy
echo "Expecting x='xx xy', got x='$x'"
set var xx; append var xy
echo "Expecting var='xx xy', got var='$var'"
set item xx; append item xy
echo "Expecting item='xx xy', got item='$item'"
and run it. The output will be
Expecting x='xx xy', got x='xx xy'
Expecting var='xx xy', got var='xx'
Expecting item='xx xy', got item='xx'
fish version installed (fish --version): fish, version 2.4.0-111-g7356987
OS/terminal used: Windows 10, mintty
When using the
-Sparameter for functions to disabled scope-shadowing, naming conflicts can occur. As a more robust alternative, a mechanism liketcl's upvar would be useful, presumably implemented as option to thesetbuiltin.Reproduction steps
Create the following fish script file:
and run it. The output will be
sh -c 'env HOME=$(mktemp -d) fish')?fish version installed (
fish --version): fish, version 2.4.0-111-g7356987OS/terminal used: Windows 10, mintty