[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why should `break' and `continue' in functions not break loops runni

From: Chet Ramey
Subject: Re: Why should `break' and `continue' in functions not break loops running outside of the function?
Date: Sat, 30 Oct 2021 11:55:31 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.1

On 10/30/21 11:02 AM, Oğuz wrote:
On Sat, Oct 30, 2021 at 4:50 PM Greg Wooledge <greg@wooledge.org> wrote:
As Chet said, it's counterintuitive.  Most people don't expect function A
to be able to affect loops inside function B.

I do, and a subshell can prevent function A from affecting loops
inside function B. But that is not a real problem, you wouldn't call,
say `break 3', when you're only 2 loop levels deep in a function
unless you wanted to exit from the loop from within the function is
called after returning.

It's a violation of scope.

It's a violation of lexical scope, I'm asking why not implement
dynamic scope, what's wrong with it?

You might be interested in


There was a discussion on the austin-group mailing list back in 2016
accompanying this defect report.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]