See issue #565 for a discussion about this.
https://github.com/fish-shell/fish-shell/issues/565
On Sun, May 26, 2013 at 3:23 PM, Harm Aarts <harmaa...@gmail.com> wrote:
> Hi,
>
> I've noticed that variables in Fish function seem to be 'declared':
>
> function sheep
> set -l feet
> if test 1 -eq 1
> set feet 4
> end
> echo $feet
> end
>
> Why is this? The definition below seems to work just fine.
>
> function sheep
> if test 1 -eq 1
> set feet 4
> end
> echo $feet
> end
>
> I was under the impression that the purpose of 'set -l' was to prevent
> leaking state beyond the function. But using the latter definition and then
> running 'set' doesn't list the 'feet' variable.
>
> What would be the idiomatic way of declaring and using variables in Fish
> functions?
>
> With kind regards,
> Harm
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
>
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users