title: How do you USE Fortran 90 module data
body: <p>Let's say you have a Fortran 90 module containing <em>lots</em> of variables, functions and subroutines.  In your <code>USE</code> statement, which convention do you follow:</p>
  
  <ol>
  <li>explicitly declare which variables/functions/subroutines you're using with the <code>, only :</code> syntax, such as  <code>USE [module_name], only : variable1, variable2, ...</code>?</li>
  <li>Insert a blanket <code>USE [module_name]</code>?</li>
  </ol>
  
  <p>On the one hand, the <code>only</code> clause makes the code a bit more verbose.  However, it forces you to repeat yourself in the code and if your module contains <em>lots</em> of variables/functions/subroutines, things begin to look unruly.</p>
  
  <p>Here's an example:</p>
  
  <pre><code>module constants
    implicit none
    real, parameter :: PI=3.14
    real, parameter :: E=2.71828183
    integer, parameter :: answer=42
    real, parameter :: earthRadiusMeters=6.38e6
  end module constants
  
  program test
  ! Option #1:  blanket "use constants"
  !  use constants
  ! Option #2:  Specify EACH variable you wish to use.
    use constants, only : PI,E,answer,earthRadiusMeters
    implicit none
  
    write(6,*) "Hello world.  Here are some constants:"
    write(6,*) PI, &amp;
         E, &amp;
         answer, &amp;
         earthRadiusInMeters
  end program test
  </code></pre>
  
  <p><strong>Update</strong>
  Hopefully someone says something like <em>"Fortran?  Just recode it in C#!"</em> so I can down vote you.</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>I like <a href="https://stackoverflow.com/questions/1240510/how-do-you-use-fortran-90-module-data/1240696#1240696">Tim Whitcomb's answer</a>, which compares Fortran's <code>USE modulename</code> with Python's <code>from modulename import *</code>.  A topic which has been on Stack Overflow before:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/710551/import-module-or-from-module-import">‘import module’ or ‘from module import’</a></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/710551/import-module-or-from-module-import/710603#710603">In an answer</a>, Mark Roddy mentioned:
  
  <blockquote>
    <p>don't use 'from module import *'. For
    any reasonable large set of code, if
    you 'import *' your will likely be
    cementing it into the module, unable
    to be removed. This is because it is
    difficult to determine what items used
    in the code are coming from 'module',
    making it east to get to the point
    where you think you don't use the
    import anymore but its extremely
    difficult to be sure.</p>
  </blockquote></li>
  </ul></li>
  <li><p><a href="https://stackoverflow.com/questions/193919/what-are-good-rules-of-thumb-for-python-imports">What are good rules of thumb for python imports?</a></p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/193919/what-are-good-rules-of-thumb-for-python-imports/193979#193979">dbr's answer</a> contains
  
  <blockquote>
    <p>don't do from x import * - it makes
    your code very hard to understand, as
    you cannot easily see where a method
    came from (from x import *; from y
    import *; my_func() - where is my_func
    defined?)</p>
  </blockquote></li>
  </ul></li>
  </ul>
  
  <p>So, I'm leaning towards a consensus of explicitly stating all the items I'm using in a module via</p>
  
  <pre><code>USE modulename, only : var1, var2, ...
  </code></pre>
  
  <p>And as <a href="https://stackoverflow.com/questions/1240510/how-do-you-use-fortran-90-module-data/1240583#1240583">Stefano Borini mentions</a>, </p>
  
  <blockquote>
    <p>[if] you have a module so large that you
    feel compelled to add ONLY, it means
    that your module is too big. Split it.</p>
  </blockquote>