(j3.2006) badly worded semantics for the IMPORT statement
Mon Dec 3 23:31:01 EST 2007
Bill Long wrote:
> I think this is what was meant: If you have an entity that satisfies two
> 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.
> 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 188.8.131.52 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."
>>J3 mailing list
>>J3 at j3-fortran.org
Consider the module
INTEGER, PARAMETER :: I = BIT_SIZE(N)
Applying the definition of "definition" given in Section 2.5.5
literally, this module is standard conforming unless the module
variable N is assigned a value. That is clearly not what was
intended, but it is what the standard says. I would prefer for
the standard to say what it means and means what it says.
More information about the J3