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

Make reserved word "function" a little more reserved?



Consider:

zsh% eval function foo() { print $0 }

This defines both "eval" and "foo" as functions that print their name,
but leaves "function" untouched.  Perhaps upon encountering the word
"function" in such a context, the parser could arrange to apply the
function definition only to the words that appear to its right, not to
the words that appear to its left?

Consider further:

zsh% eval function foo { print $0 }
zsh: parse error near `}'

This seems unnecessary, somehow.

Yeah, I know, eval isn't a reserved word, so neither is function in that
context, it's just anti-foot-shooting that makes this, ah, function.

-- 



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