Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.shell > #4451

Re: Why 'break' even has effects outside of its function?

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.unix.shell
Subject Re: Why 'break' even has effects outside of its function?
Date 2012-03-14 05:59 +0000
Organization Aioe.org NNTP Server
Message-ID <20120313223729.159@kylheku.com> (permalink)
References <jj1t5r$nsj$1@wangcong.dont-email.me> <20120306215813.85@kylheku.com> <jj77u1$jn3$1@speranza.aioe.org> <20120307010429.677@kylheku.com> <jj920j$flf$1@speranza.aioe.org>

Show all headers | View raw


On 2012-03-08, Alan Curry <pacman@kosh.dhis.org> wrote:
> In article <20120307010429.677@kylheku.com>,
> Kaz Kylheku  <kaz@kylheku.com> wrote:
>>On 2012-03-07, Alan Curry <pacman@kosh.dhis.org> wrote:
>>> In article <20120306215813.85@kylheku.com>,
>>> Kaz Kylheku  <kaz@kylheku.com> wrote:
>>>>On 2012-03-05, Alan Curry <pacman@kosh.dhis.org> wrote:
>>>
>>> Me and pdksh don't think so, since we see looping control structures as
>>> super-low-level stuff that should resolve at parse time, and shell variables
>>> as a simple global mapping of strings to other strings.
>>
>>That is laughably inconsistent. Part of the language has delusions of grandeur
>>about becoming a compiled language one day, and part of the language is
>>a dynamically scoped hack. 
>>
>>Simple global mapping? Are there no locals then?
>
> Yeah, there are. I don't think they change anything.

> Getting more and more curious about why these things are the way they are, I
> looked at the pdksh source to find out what it's really doing. Its break
> command turns out to be just as dynamically-scoped as the other shells, with
> an explicit test for various types of execution nodes that stop the search
> for a matching loop.

By the way, bash's implementation of break is uninspiring. It's
a hack based on a counter indicating the level of loop nesting,
and a ``we are breaking now out of N levels'' type of flag
which is checked at every level to implement a bail.

There is no actual dynamic scope search.

Back to comp.unix.shell | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why 'break' even has effects outside of its function? Cong Wang <xiyou.wangcong@gmail.com> - 2012-03-05 08:23 +0000
  Re: Why 'break' even has effects outside of its function? Lew Pitcher <lpitcher@teksavvy.com> - 2012-03-05 01:03 -0800
    Re: Why 'break' even has effects outside of its function? Cong Wang <xiyou.wangcong@gmail.com> - 2012-03-05 09:42 +0000
      Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-05 13:59 +0000
      Re: Why 'break' even has effects outside of its function? Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-05 15:40 +0100
        Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-05 15:18 +0000
          Re: Why 'break' even has effects outside of its function? "Ed Morton" <mortonspam@gmail.com> - 2012-03-05 16:03 +0000
            Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-05 16:37 +0000
              Re: Why 'break' even has effects outside of its function? "Ed Morton" <mortonspam@gmail.com> - 2012-03-05 17:49 +0000
                Re: Why 'break' even has effects outside of its function? gazelle@shell.xmission.com (Kenny McCormack) - 2012-03-05 18:02 +0000
                Re: Why 'break' even has effects outside of its function? Ed Morton <mortonspam@gmail.com> - 2012-03-05 17:57 -0600
          Re: Why 'break' even has effects outside of its function? Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-05 19:22 +0100
            Re: Why 'break' even has effects outside of its function? pacman@kosh.dhis.org (Alan Curry) - 2012-03-05 22:15 +0000
              Re: Why 'break' even has effects outside of its function? Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-06 12:04 +0100
                Re: Why 'break' even has effects outside of its function? pacman@kosh.dhis.org (Alan Curry) - 2012-03-06 23:10 +0000
              Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-07 05:58 +0000
              Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-07 05:58 +0000
              Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-07 07:25 +0000
                Re: Why 'break' even has effects outside of its function? pacman@kosh.dhis.org (Alan Curry) - 2012-03-07 08:57 +0000
                Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-07 09:39 +0000
                Re: Why 'break' even has effects outside of its function? pacman@kosh.dhis.org (Alan Curry) - 2012-03-08 01:28 +0000
                Re: Why 'break' even has effects outside of its function? Sven Mascheck <mascheck@email.invalid> - 2012-03-13 22:50 +0000
                Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-13 23:00 +0000
                Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-14 05:59 +0000
            Re: Why 'break' even has effects outside of its function? Kaz Kylheku <kaz@kylheku.com> - 2012-03-07 05:48 +0000
          Re: Why 'break' even has effects outside of its function? Barry Margolin <barmar@alum.mit.edu> - 2012-03-05 13:29 -0500

csiph-web