On Thu, Aug 14, 2008 at 12:20 PM, kazumi iwane <[EMAIL PROTECTED]> wrote: > if you want to delay the expansion of an env var until fn invocation,,use > eval. > > % fn foo {eval echo $$bar}
sorry, but that's so, so wrong. 1) $$bar gives the value of the variable named by the contents of the variable bar, so that the above, given that $bar contains 'baz' will echo $baz. 2) $$bar above is evaluated _before_ eval is invoked, so the line is not very different from {echo $$bar}, except that if $$bar holds any syntax characters they'll get interpreted by the shell. it's almost never necessary to use eval with rc. 3) expansion of env. vars *is* delayed until fn invocation. e.g. % fn foo {echo $bar} % bar = baz % foo baz % it just seems as if the local variable assignment isn't propagated into the fn context. i don't have time to look into it now (i really shouldn't be spending time writing this email, but i couldn't resist the bait). rog.