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

Re: Determining whether a function is used in an arithmetic context



On Mon, 24 Jul 2017 22:47:39 -0500
dana <dana@xxxxxxx> wrote:
> I was playing with arithmetic functions recently and i wanted to have one
> of them behave differently depending on whether it's used in an arithmetic
> context or not. I can't seem to figure out a *reliable* way to detect that,
> though.

(This part of the discussion on zsh-workers.)

If it seems worth doing, expanding doshfunc so the last argument is a
set of bit flags and adding an argument to runshfunc to indicate a
context that would show up in the appropriate place in $zsh_eval_context
(potentially useful for modules to make functions called in a particular
way easy to detect) isn't hard. But if it's more churn that people won't
actually use much it's probably not worth doing.

pws



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