Manual: super and global namespaces example doesn't demonstrate the feature
The Scopes (super and global namespaces) example is as follows:
let a = 1
fn demo
let b = 2
fn nested
echo ${super::b}
echo ${global::a}
end
nested
end
demo
This code is functionally equivalent to:
let a = 1
fn demo
let b = 2
fn nested
echo $b
echo $a
end
nested
end
demo
This doesn't demonstrate the super and global namespace feature since $a and $b can be accessed just fine without using them.
In fact, I could not find any situation where this feature would apply. The Scopes chapter says Functions have the scope they were defined in.
which from my understanding implies a function always has access to the "super" scope (and if applied recursively, the global scope).
One guess was that this feature was meant to a situation like this where the variable is defined in the scope the function was called from:
fn print_vars
echo ${super::y}
end
if test 1 == 1
let y = 3
print_vars
end
However that doesn't work (and I guess is unnecessary since you can pass variables to functions as a parameter).