[J3] please try running this program
Steve Lionel
steve at stevelionel.com
Tue Oct 25 01:01:22 UTC 2022
On 10/24/2022 8:45 PM, Malcolm Cohen via J3 wrote:
> We did not change the scoping rules for this in Fortran 2018. And we
> know this because we did not list such a change in the compatibility
> clauses.
I believe this, but I think I understand why Bob thought otherwise. I'll
admit that sometimes the fine points elude me, but...
A derived type definition is a scoping unit (3.123). The scope of a
local variable is an inclusive scope (19.4). Inclusive scope is
"nonblock scoping unit plus every block scoping unit whose host is that
scoping unit or that is nested within such a block scoping unit" (3.87).
References to N2209.
I read this as saying that the scope of a variable whose implicit
declaration is inside a derived type definition is that type definition.
If there are words that say otherwise, I haven't found them yet.
Why is a derived type definition a scoping unit? Is it to restrict the
scope of its named components? If so, it seems to me that has some
unwanted side-effects.
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221024/de62a139/attachment.htm>
More information about the J3
mailing list