(j3.2006) statement labels and scope
Robert Corbett
robert.corbett
Thu Jan 14 19:18:12 EST 2016
On 01/14/16 15:47, Bill Long wrote:
> On Jan 14, 2016, at 5:19 PM, Robert Corbett<robert.corbett at oracle.com> wrote:
>
>> On 01/14/16 12:56, Bill Long wrote:
>>> In 3.2.5 Statement labels we say that a statement label shall not be given to more than one statement ?in its scope?. Since BLOCK constructs are scopes, if this is taken as stated, the following
>>>
>>> subroutine sub
>>> 10 continue
>>>
>>> block
>>> 10 continue
>>> end block
>>>
>>> end subroutine sub
>>>
>>> should be conforming. In, instead, we actually meant ?inclusive scope?, then it would not be. Personally, I think that allowing this is preferred, and would not require a wording change. But I?m checking because I see inconsistent behavior with different compilers. (And this is in one of my clauses to read this time).
>> We did mean inclusive scope. The section on scopes makes this clear.
>>
>> Subclause 16.1 of 10-007r states
>>
>> The scope of ... a local identifier is its inclusive scope.
>>
>> Subclause 16.3.1 says that statement labels are local identifiers.
> unless they are construct entities.
>
>> Subclause 16.4 does not say that statement labels can be statement
>> or construct entities.
> So, we conclude that either 3.2.5 or 16.4 is wrong.
>
I do not see how you arrive at that conclusion. Subclause 3.2.5 states that
The same statement label shall not be given to more
than one statement in its scope.
Clause 16 makes it clear that the scope of a statement label is an inclusive
scope. I see no conflict.
If a statement label could be a statement entity or a construct entity, there
might be a conflict, but it cannot, so there is no conflict.
Bob Corbett
More information about the J3
mailing list