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

Important discussion about "local" on the POSIX list



austin-group is discussing a proposal to make local variables
lexical/static in scope, rather than dynamic in scope as in bash and
zsh.

I don't seem to be able to post to that list, so if there's someone
here who still can, please have a gander and chime it.

The discussion ranges over

(1) whether "function name { ... }" vs. "name() { ... }" syntax
determines whether a variable defined within the function has static
scope (ksh93) and the keyword used to declare it is irrelevant;

(2) whether "typeset" or "local" or something else would be used to
declare such variables;

(3) whether "local" would be allowed to have dynamic scope at all.

It would be rather difficult in zsh's implementation to enforce
lexical scoping, so we'd be faced with either giving up POSIX
compliance or doing a massive rewrite.



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