The same thing happens in a simpler form:
set -x foo bar
If you now run
echo $foo, it is not set either. That's because fish's
-x by itself doesn't change the scope of the variable, which is by default local to the function unless it exists globally or universally already.
eval (echo 'set -gx FOO 1;')
g is for global. This makes the variable work like a normal POSIX
exported value. It's interesting that it works the same way with
eval as it would with just plain
set; if you use that line sans
g straight on the command line,
$FOO is set, so
eval and process substitution
() have not introduced a new scope or subshell, and when executed that way within a function, the scope of the function applies.