28 ms·
That's very impressive, it almost feels like a legit useful hack. Why was it not fixed in zsh? Did they decide it was working as intended?
by barosl 5y ago
That's very impressive, it almost feels like a legit useful hack. Why was it not fixed in zsh? Did they decide it was working as intended?
- naniwaduni 5y agoWell, bash's new behaviour (noisily complain and do nothing, reporting success) doesn't do anything useful, so implementing it gratuitously breaks old code to no gain. Dynamic stack-crawling is more or less the most popular historical behaviour (though afaict the Bourne/Korn lineage just silently fails breaks outside the enclosing function); it's just generally consistent with everything else in the shell that's globally/dynamically scoped. Even in the shells where you can't break out of your enclosing function, `eval break` still breaks through loops in your current context, and that kind of looks like a function you called that called break if you squint. (POSIX expressly leaves this case undefined with a carveout for break/continue inside the body of a function lexically contained within a loop.)