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

Re: Completion function for bitkeeper?



Oliver Kiddle wrote:
> _foo() {
>   local expl
>   _description foo expl foos
>   _bar "$expl[@]"
> }
> 
> As a result of zsh having dynamic scoping, _foo's $expl is still
> visible inside _bar. _foo happens to use $expl for storing compadd
> options to pass on. Knowing this the author of _bar could take
> advantage of it but it'd be bad programming (and might break if _bar
> was called from elsewhere). To actively prevent it, we need static
> scoping.

Hmm... isn't the problem that the $expl set at this point and passed
down to _bar ultimately ends up getting passed to compadd (maybe
indirectly), while _bar may add its own options?  I've seen this sort of
thing when trying to sort out the sorting, i.e. the -J and -V options to
compadd.  Often one of them's already lurking in $expl at the point
where I want to propagate my choice of option down through the system.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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