Use in Modules



As I see it there are three ways of using USE statements in modules.
Can someone point out the pitfalls/advantages not listed (or even
other approaches).

1) In specification area only:

module A
private

use x_module
use y_module
.....
contains
.......
end module A

The benefits of this is it is readily seen which modules are needed to
support the specific module of interest.

The limits are broader scope of variable names than needed.
Additionally when subs are broken out of the module they will need the
required USE statements added.


------------------------------------

2) In areas needed only:

module A
private
......
contains

subroutine alpha
use x_module
......
end subroutine alpha

subroutine beta
use y_module
......
end subroutine beta

The benefits are completely controlled scope. Additionally when the
contained routines are broken out they have the required modules
labeled already.

However this lacks an easy automatic way to see all the required
supporting modules.

--------------------------------------------

3) The combination of the two:

module A
private

use x_module, only: z,zzz
use y_module
......
contains

subroutine alpha
use x_module, only: z
......
end subroutine alpha

subroutine beta
use y_module
use x_module, only: zzz
......
end subroutine beta

This has the benifits of listing required supporting modules and the
ability to break out individual subroutines without modification.

The problems are that the only lists are concatenated from the
specification area and the local declaration.

Are there better ways to achieve the benefits of automatic listing in
the module specification area, fully portable subroutines AND fully
controlled scope without any of the limitations?

Chris
.