Re: [RFC] Logically composable variant of errexit

2014-10-13 Thread Chet Ramey
On 10/10/14, 5:26 AM, Andreas Grünbacher wrote: > 2014-10-10 3:29 GMT+02:00 Chet Ramey : >> What does logically composable mean in this context? > > I would like the hypothetical errfail option to: > > * Behave like errexit at the top level (outside of functions). > > * Be inherited by functio

Re: [RFC] Logically composable variant of errexit

2014-10-10 Thread Ángel González
On Andreas Grünbacher wrote: > With errexit, you get vastly different results from functions depending > on how the functions are called, for example, > >foo() { > echo "foo: top" > false > echo "foo: bottom" >} > >set -o errexit > ># bottom of foo reached: >

Re: [RFC] Logically composable variant of errexit

2014-10-10 Thread Andreas Grünbacher
2014-10-10 8:38 GMT+02:00 Dan Douglas : > I would still propose that a simple and powerful way to extend Bash with > exception handling would be to extend the ERR trap by passing it some metadata > about the type and location of the exception incurred so that it can be > handled > by user code. Th

Re: [RFC] Logically composable variant of errexit

2014-10-10 Thread Andreas Grünbacher
2014-10-10 3:29 GMT+02:00 Chet Ramey : > What does logically composable mean in this context? I would like the hypothetical errfail option to: * Behave like errexit at the top level (outside of functions). * Be inherited by functions, subshells, and command substitution. * Inside functions,

Re: [RFC] Logically composable variant of errexit

2014-10-09 Thread Dan Douglas
I would still propose that a simple and powerful way to extend Bash with exception handling would be to extend the ERR trap by passing it some metadata about the type and location of the exception incurred so that it can be handled by user code. This proposal allows us to largely avoid having to an

Re: [RFC] Logically composable variant of errexit

2014-10-09 Thread Chet Ramey
On 10/9/14, 8:20 AM, Andreas Grünbacher wrote: > Hi all, > > the errexit option can be very useful in simple scripts. This option > is being ignored in many contexts like lists and conditionals though. > I understand that this is "by design" and that errexit cannot be > "fixed" to behave more reas

Re: [RFC] Logically composable variant of errexit

2014-10-09 Thread Ángel González
Andreas Grünbacher wrote: > Hi all, > > the errexit option can be very useful in simple scripts. This option > is being ignored in many contexts like lists and conditionals though. > I understand that this is "by design" and that errexit cannot be > "fixed" to behave more reasonably. Still, this m

[RFC] Logically composable variant of errexit

2014-10-09 Thread Andreas Grünbacher
Hi all, the errexit option can be very useful in simple scripts. This option is being ignored in many contexts like lists and conditionals though. I understand that this is "by design" and that errexit cannot be "fixed" to behave more reasonably. Still, this makes bash a lot less useful than it co