(j3.2006) badly worded semantics for the IMPORT statement
Bill Long
longb
Tue Nov 27 12:21:37 EST 2007
I think this is what was meant: If you have an entity that satisfies two
conditions:
1) it is available in an interface by being imported, and
2) it is defined in the host scoping unit,
then it is also required to be explicitly declared prior to the
interface body. This makes sense in the case of a named constant,
which is a common thing to be imported. It does seem to be defective in
the case of a type name, which is the other common case, A type is
defined, but never "declared", so I'd argue that the "declared" is the
faulty part of the sentence. A less common case would be to import the
name of a variable which is not initialized. It could be used as the
argument to a KIND() reference as part of a declaration in the
interface, for example. The current wording does not require that this
variable be declared before the interface (the sentence does not apply),
whereas your suggested change would impose this requirement. It think
such a change would require an interp.
I'd note that essentially the same statement appears twice, at [260:4-5]
and [260:11-12], but with different sentence structure. My wording
above follows more closely the second sentence in the standard. Maybe
it would be clearer, and more consistent, to use the same sentence form
in both places.
Cheers,
Bill
Robert Corbett wrote:
> Someone here at Sun recently asked why it made a difference whether
> a variable named in an IMPORT statement was assigned a value. He
> pointed out that Section 12.3.2.1 of the Fortran 2003 standard states
>
> An entity that is imported in this manner and is defined
> ^^^^^^^
> in the host scoping unit shall be explicitly declared
> prior to the interface body.
>
> Perhaps it would be better to say "declared" instead of "defined."
>
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://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., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
More information about the J3
mailing list