Mick Maier wrote:
> The standard does not permit the recursive or circular use of module
> use, like the following.
> module A
> use B
> end module A
> module B
> use A
> end module B
> What is the best practice to circumvent this? A common situation is
> that a pseudo-object (defined in module A) is passed to some function
> (in module B), where one needs to call a function of the pseudo-object
> (e.g. an accessor)
Hello,
Sounds like you're making module A do too much.
Why not let module A just define the object (constructor, accessor(s)). If methods in
module B are still required for module A to do its definition/access job, then they
shouldn't be in module B, but in A.
I think of it in terms of definition and application modules, e.g.
module A_Def
....
end module A_Def
module A_App
use A_Def
....
end module A_App
Module A_Def defines the object, A, for a particular task and needs nothing else (well,
maybe utility modules for defining types, setting common parameters, etc, but nothing "A"
related), and module A_App uses that definition to do stuff.
cheers,
paulv
--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx