On 11/03/20 15:01, Joerg Schilling wrote:
> Dirk Fieldhouse <fieldho...@gmx.net> wrote:
>
>> As to "baffling semantics", I suggest that these are two examples
>> where 'return' is meaningful (and far from baffling) and that "foo"
>> and not "bar" should be printed in each case:
>>
>> f1() {
>>     ( echo foo; return )
>>     echo bar
>> }
>
> Do you know a single shell that prints only foo in this case?
>
> All shells I am aware of print foo and bar

The discussion seems to have confirmed that this is the general existing
practice, and not just in the few cases I tested, but IMO only a shell
implementer could see the suggested behaviour of these examples as
baffling, based on the wording of the standard (not to mention "man sh",
etc, so I won't). For instance, Chet Ramey's (11/03/20 15:23) comments
on examples f1() and f2() draw on under-the-hood rationale that does not
appear to be reflected in the standard text. In particular I don't see
any suggestion that either usage might be "unspecified".

The question is what, if any, rewording of the standard should be made.
There are plenty of choices for better designed scripting languages, so
arguably making the specification agree with existing practice would be
an acceptable resolution. The example of DR 842 for 'break' and
'continue' shows that this should not be seen as an unnecessary change.

/df

--
London SW6
UK

Reply via email to