Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: wheels within wheels



On Sep 29,  9:15pm, Ray Andrews wrote:
}
} Each command is past when it's past so that must mean that the address
} of first foo ... is there ... yes of course there is, the thing is in
} memory ... just aborts when second foo comes along.

No, the outer foo will happily keep executing until it returns, at
which point it is garbage-collected.  The old body has merely been
disconnected from the name.

    function foo {
      echo defining bar
      function bar {
	echo hello from bar
      }
      echo redefining foo
      function foo {
	echo hello from new foo
	bar
      }
      foo
      echo goodbye from the old foo
    }



Messages sorted by: Reverse Date, Date, Thread, Author