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

Re: PATCH: funcstack[-1] (formerly Suppress tracing of "set +x")



On Feb 5,  4:46pm, Peter Stephenson wrote:
} Subject: Re: PATCH: funcstack[-1]  (formerly Suppress tracing of "set +x")
}
} On Fri, 05 Feb 2016 08:14:28 -0800
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > On Feb 5,  4:02pm, Peter Stephenson wrote:
} > }
} > } My main worry is someone is using ${#funcstack} to decide if they're at
} > } top-level, rather than zsh_eval_context, which would now fail.
} > 
} > There are several uses of $#funcstack in the Completion/ function suite.
} 
} None of them are sensitive to (permanently) adding an extra level at the
} end of the array, as far as I can see.

My concern is that $_tags_level is initialized to 0 in _main_complete
and then compared to $#funcstack later.  If $#funcstack is now always no
less than 1, that will be wrong.

Of course we can fix _main_complete to initialize to 1, but this does
imply that comparisons to $#funcstack are not an unknown programming
technique.



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