Re: feature request: new builtin `defer`, scope delayed eval

2022-10-07 Thread Cynthia Coan
Hi Koichi, I'm well aware that "defer"/"safe trap appending" can be implemented today as it stands (see the original email in this chain, which links to an example that I've used in a more reduced form). I also have in the past written several helpers for safely appending to a trap (yours in parti

Re: feature request: new builtin `defer`, scope delayed eval

2022-10-07 Thread Koichi Murase
2022年10月8日(土) 12:04 Cynthia Coan : > [...] > > Otherwise, I think we can perhaps reword this into two smaller > features: "function local trap signals", The existing RETURN trap is exactly the trap that can be used to clean up resources local to functions and is already ``function-local'' unless t

Re: feature request: new builtin `defer`, scope delayed eval

2022-10-07 Thread Oğuz İsmail Uysal
On 10/8/22 6:03 AM, Cynthia Coan wrote: Otherwise, I think we can perhaps reword this into two smaller features: "function local trap signals", and I don't think this would be a feature worth the time to implement and the complexity it would introduce. Is there any other use case for this than

Re: feature request: new builtin `defer`, scope delayed eval

2022-10-07 Thread Cynthia Coan
I definitely got the inspiration of the name from the Go programming language. There are several other languages who use similar concepts when dealing with cleanup where something like an RAII pattern to free resources. It sounds like we're leaning towards trap, over a new built-in which I think i

Re: feature request: new builtin `defer`, scope delayed eval

2022-10-07 Thread Dale R. Worley
The Go programming language has a "defer" statement which is used considerably for exactly this purpose. So we know that it's useful in practice. The question remains what is a good way to introduce it into Bash. As others have noted, there is already a "trap" with similar functionality. I'm no

Re: extglob can be erroneously enabled in bash-5.2 through comsub nesting

2022-10-07 Thread Chet Ramey
On 10/6/22 7:58 PM, Kerin Millar wrote: Thanks for the report. I've attached the patch I applied to fix this. Thanks for the patch. It is probably sufficient for the downstream bug report to be closed. Unfortunately, it remains the case that the >=5.2-rc3 parser is buggy. Thanks for the ad

Re: bracket needs to be escaped in variable substitution?

2022-10-07 Thread Chet Ramey
On 10/6/22 6:04 PM, Antoine wrote: Issue is not reproduced when using a variable as pattern, and it's not related the space character in the pattern: Thanks for the report. This will be fixed in the next devel branch push. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer