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

Re: Scope of local parameters



Peter wrote:
> 
> > Hmm ... making typeset create local parameters in sourced script by default
> > will definitely break a lot of existing scripts.

> > Probably extra argument to
> > typeset or (better) extra options to treat typesets in script as local.
> 
> Certainly possible, but will need some extra wiring.  I should think
> thre's some possible fudge involving locallevel, scanendscope and a new
> parameter flag, rather than adding a completely new mechanism.  I think

Except that the parameter code has enough fudges holding it together
already.

So that we don't end up with too many typeset flags, this could perhaps
be combined with some facility for ksh93 style lexical scoping. Perhaps
allowing scope to be restricted to within { ... }, do .. done and if
... fi blocks. Another option might be some syntax for in place
functions - some variant of the { ... } block in which local variables
would apply.

Oliver



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