On 2013-07-30 12:45, Pierre Gaston wrote:
> On Tue, Jul 30, 2013 at 12:29 PM, Chris Down <ch...@binary.com> wrote:
> > On 2013-07-30 12:11, Pierre Gaston wrote:
> >> what about things like this: foo () (  return 1; )
> >
> > Except in this case, the return has a valid context. I don't see how it's 
> > really
> > comparable to the represented case.
>
> It's a return in a subshell in a function, i don't think the
> comparison is far fetched.

Except in this case the function and the subshell are linked constructs.

> I see what you mean,  but that raises the question of what's a valid context.
> Should we make a special case if the subshell is the "outer" compound
> command of a function?

I am not totally convinced that this is a special case since the subshell
basically becomes the declaration.

> The same thing with by break and continue example:
>
> while :;do ( while :;do break 2; done);echo foo;done
>
> Should this raise an error? is the break in a loop context? what's a
> loop context?

Well, breaking to an undef level is already allowed and doesn't return an error
(although I think that's not your point).

        $ while :; do break 999; done
        $ echo $?
        0

If you mean "should it break the outer loop", then my opinion is no.

Attachment: pgpKXcDsu7u9F.pgp
Description: PGP signature

Reply via email to