(j3.2006) statement labels and scope
Bill Long
longb
Thu Jan 14 17:30:47 EST 2016
On Jan 14, 2016, at 3:46 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:
> If I remember the discussion about "scope" and "inclusive scope," labels
> of format statements concerned us more than branch targets.
>
A common style is to group format statements at the end of a program unit, which could be far away from the block. Allowing reuse of the same label for a format statement inside the block seems like a programmer-friendly feature. This seems to argue that the text in 3.2.5 is intentionally ?scope? and not ?inclusive scope?. Thanks for the history/background, Van.
Cheers,
Bill
> On Thu, 2016-01-14 at 21:40 +0000, Bill Long wrote:
>> On Jan 14, 2016, at 3:09 PM, Lionel, Steve <steve.lionel at intel.com> wrote:
>>
>>> Um, what about:
>>>
>>> subroutine sub
>>>
>>> block
>>> go to 10
>>> 10 continue
>>> end block
>>>
>>> 10 continue
>>> end subroutine sub
>>
>>
>> I?d argue that the text for labels would say the branch is to the
>> continue statement inside the block. As if the statements inside the
>> BLOCK construct were, instead, in a contained internal procedure.
>>
>>>
>>> The text for GO TO says "inclusive scope?.
>>
>>
>> Point taken. Making the rules for labels and GOTO (the primary user
>> of labels) consistent would be less confusing. (Although any code
>> using GOTO statements is already headed down the ?confusing? path.)
>>
>> The advantage of the current wording for labels is that you can insert
>> statement labels inside a block without having to look at the code in
>> the surrounding scope to search for label conflicts. Only if you want
>> to branch to a statement outside the block construct would you have to
>> be careful to not use that label on a statement inside the block as
>> well.
>>
>> The main question is whether the text in 3.2.5p2 needs a change, and
>> if it does, is an incompatibility notice also needed?
>>
>> Cheers,
>> Bill
>>
>>
>>>
>>> Steve
>>> _______________________________________________
>>> J3 mailing list
>>> J3 at mailman.j3-fortran.org
>>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>>
>> Bill Long longb at cray.com
>> Fortran Technical Support & voice: 651-605-9024
>> Bioinformatics Software Development fax: 651-605-9142
>> Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
>>
>>
>> _______________________________________________
>> J3 mailing list
>> J3 at mailman.j3-fortran.org
>> http://mailman.j3-fortran.org/mailman/listinfo/j3
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
More information about the J3
mailing list