(j3.2006) Intrinsic modules

Kurt W Hirchert hirchert
Sat Nov 21 20:06:15 EST 2009


Craig Dedo wrote:
> 	Does anyone remember why J3 chose to prefer nonintrinsic modules
> over intrinsic modules of the same name?
Yes, I remember.

Oh, you want to know what that reason was.  It was done this way to 
maintain compatibility with Fortran 90 and to promote continuing program 
portability.  Imagine, for example, that you have a Fortran 90 program 
that contains the statement

    USE  Barbie

to have access to procedures to heat shrimp.  (It wouldn't say 
USE,NONINTRINSIC::Barbie because that syntactic form wasn't available in 
Fortran 90, and it continues to be an unlikely choice for most modules 
because of its verbosity.)  Now imagine you tried to port this to a 
compiler provided by the Mattel corporation.  It might provide a 
[nonstandard] intrinsic module Barbie with procedures for manipulating 
fashion dolls and their accessories.  It would be no use to you in your 
desire for warm shrimp, so your program would break if intrinsic modules 
were chosen over nonintrinsic ones.  Even if you only gave preference to 
standard intrinsic modules, there's no guarantee that Mattel might not 
prevail upon the committee to standardize Barbie and Hotwheels in some 
future revision of the Fortran standard.  (If that isn't confusing 
enough, what if Barbie and Hotwheels were standardized not in a future 
revision of the Fortran standard, but in some other ISO standard, or 
even in a standard published by some other body.)

Although there are ways a vendor could justify providing a switch to 
reverse this rule, the bottom line is there probably isn't enough demand 
(and money) to get even one vendor to implement such a switch, let alone 
make it common enough to solve Van's problem.  Instead, I would suggest 
moving his nonintrinsic IEEE_Arithmetic module into a different 
directory from the rest of the source.  Then the inclusion/exclusion of 
that directory in his module search path becomes the switch to determine 
whether the nonintrinsic or intrinsic version of IEEE_Arithmetic is to 
be used.  This isn't quite as automatic as the switch Van asked for, but 
it is something he can do now, it eliminates the need to change his 
source code, and he probably has to change compiler switches on each new 
platform anyway.


-Kurt



More information about the J3 mailing list