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

Re: Can ZWC be optimized, for lesser depths of recursive exec* calls?



On 25 lipca 2017 at 07:04:07, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> On Mon, Jul 24, 2017 at 6:26 PM, Sebastian Gniazdowski
> wrote:
> >
> > It's just that I suspect "recurse and forget" tactics in exec.c.
>  
> I don't know what you mean by this.

The example in comment in exec.c is:

    cat foo | while read a; do grep $a bar; done

Expected calls are:

    execlist->execpline->execcmd->execwhile->execlist->execpline

This shows that grep is treated as a potential pipe. So what I mean is that the problem with pipes (the topic of the comment) is solved by having enough general execpline(), and then just recursing, always, and expect a positive outcome to be computed. Like the zlecore() example – main Zle works, so calling it again "should not cause problems", to simulate typical programmer thinking in such situation. So it's an opportunity to not write new code, just reuse what's there already, tested and working.

--  
Sebastian Gniazdowski
psprint /at/ zdharma.org



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