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

Re: PATCH: skip command from debug trap



"Rocky Bernstein" wrote:
> Others have noted the challenges in adding an option to return. Making
> the semantics of the return statement already more complicated doesn't
> seem wise.

However, as I've pointed out I can guarantee to make that compatible
with the current shell, and at the same time make return work as in
other shells (apart from the math eval of the numeric argument, which
would cause an error in other shells anyway) which it doesn't at the
moment.  Once we have the latter adding an option is trivial.  Adding an
option to a builtin is about the simplest thing it's possible to do.

> A couple other approaches are setting a variable or calling a routine.
>  For example  "trap_return --skip"  or TRAP_RETURN="skip"

On the other hand, I can't make this compatible with existing versions
(the standard namespace pollution problem).

I don't like adding a new builtin just for this.

The variable version is doable, we've done similar things before.  You'd
have to note that it didn't force return from the current environment,
either the inline trap or TRAPDEBUG.  You'd also have to be prepared for
the shell to manipulate the variable behind your back, else you'd run
into problems with having it set on future traps.  It's not disastrous,
but I'm not convinced this is simpler.  In fact, at the moment it seems
to me manifestly much more complicated.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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