From: Geico Caveman on
On 2009-10-12 11:27:24 -0700, dpb <none(a)non.net> said:

> Geico Caveman wrote:
> ...
>> If it allowed something like:
>>
>> module mex
>> integer, parameter :: mptr=selected_int_kind(9)
>>
>> interface
>> import :: mptr
>> integer (kind=mptr) function(...)
>> ...
>> end function
>> ! 20 more such functions
>> ...
>>
>> end interface
>>
>> end module
>>
>> I could see its utility, but it doesn't. Maybe I am missing something again ?
>
> It obviates the need for the other module.

In my case, that makes no difference. I have a module defining various
programmatic, physical and mathematical constants in any case. I
generally have such a module in all my code.

>
> Don't see anyway around the inclusion of the import statement in each
> function interface block owing to the past decision that they don't
> otherwise inherit anything.

I guess I will not be using the import statement much then.

Can one use the import statement in a module containing only function
declarations (no contains statement) ?

From: Richard Maine on
Geico Caveman <spammers-go-here(a)spam.invalid> wrote:

> Can one use the import statement in a module containing only function
> declarations (no contains statement) ?

Yes. In fact, it has zero to do with CONTAINS. The import statement is
only for interface bodies. Interface bodies do not go after a CONTAINS.
Well, you can have an interface body in a module procedure, where the
module procedure is after the CONTAINS of the module; perhaps that's
what you are envisioning. That is ok, but the CONTAINS is mostly just
irrelevant to the matter.

You can put an import statement in any interface body anywhere. It has
nothing to do with whether the interface body is in the global module
scope or in some procedure (or even inside of another interface body).
It doesn't have to involve modules at all. The import statement just
imports from whatever the host scoping unit is. An interface body always
has a host scoping unit; it can't stand alone.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain