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

Re: PATCH: expl not always local



On Jun 2,  6:44pm, Oliver Kiddle wrote:
} Subject: Re: PATCH: expl not always local
}
} Bart wrote:
} > Careful with these.  They may be expecting to be called in a context
} > where the caller has declared expl as a local.
} >
} > In general, if a function file starts with #autload then it's a
} > utility and should NOT declare completion system variables as locals,
} 
} I disagree. The only way we should be passing stuff to #autoload (Type/)
} functions is with the positional parameters.

I agree with your "should" but I don't believe that it's presently the
case that all completion functions work that way.  Blindly adding a lot
of "local" declarations without investigating the calling contexts is
a road to mysterious future breakage.

In part this is because the inner workings of the completion system are
so sketchily documented.  The Doc/compsys.yo entry for _wanted, for example,
doesn't use "local expl" in its examples, and none of the documentation is
clear that the name "expl" is merely a convention for the second argument
of things like _request/_wanted/_next_label/etc. (i.e., any other name
ought to do just as well, but probably won't).



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