From owner-sc22wg5@dkuug.dk  Wed Jun 25 20:24:45 2003
Received: (from majordom@localhost)
	by dkuug.dk (8.12.8p1/8.9.2) id h5PIOjX6060860
	for sc22wg5-domo; Wed, 25 Jun 2003 20:24:45 +0200 (CEST)
	(envelope-from owner-sc22wg5@dkuug.dk)
X-Authentication-Warning: ptah.dkuug.dk: majordom set sender to owner-sc22wg5@dkuug.dk using -f
Received: from math.jpl.nasa.gov (math.jpl.nasa.gov [137.79.7.57])
	by dkuug.dk (8.12.8p1/8.9.2) with ESMTP id h5PIOeEc060855
	for <sc22wg5@dkuug.dk>; Wed, 25 Jun 2003 20:24:41 +0200 (CEST)
	(envelope-from vsnyder@math.jpl.nasa.gov)
Received: from math.jpl.nasa.gov (localhost.localdomain [127.0.0.1])
	by math.jpl.nasa.gov (8.12.8/8.12.8) with ESMTP id h5PIOcJe028105;
	Wed, 25 Jun 2003 11:24:38 -0700
Received: from math.jpl.nasa.gov (vsnyder@localhost)
	by math.jpl.nasa.gov (8.12.8/8.12.8/Submit) with ESMTP id h5PIOb8v028101;
	Wed, 25 Jun 2003 11:24:37 -0700
Message-Id: <200306251824.h5PIOb8v028101@math.jpl.nasa.gov>
X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4
To: sc22wg5@dkuug.dk
cc: "J.L.Schonfelder" <j.l.schonfelder@liverpool.ac.uk>
Reply-to: Van.Snyder@jpl.nasa.gov
Subject: Submodule association and host association
From: Van.Snyder@jpl.nasa.gov
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 25 Jun 2003 11:24:37 -0700
Sender: owner-sc22wg5@dkuug.dk
Precedence: bulk


Lawrie wrote:

> My only disagreement is with host association as the association rule 
> applying between the disjoint scopes of a submodule and its parent. Van 
> says he is not convinced by my arguments against host association. I can 
> only reply that I am totally unconvinced that there are any arguments FOR 
> host association. I have seen no agrument pointing out any technical, 
> expressive or functional advantages for using this association rule apart 
> from the trivial one that it already exists.

One possibility that has been suggested is to extend the Submodule idea
to let them be inside of modules instead of just beside them.  Modula-2
always allowed modules within modules.  I used this facility occasionally
to partition the resources within a module into those that are available
globally (and of course everywhere within the module) and those that are
shared by a subset of the module's procedures.  If Fortran had done this
in 1988 -- and Modula-2 was already ten years old by then, so we had a
model -- we wouldn't have needed accessibility attributes for module
entities (but we would still have needed them for components).

Some processors traverse the transitive closure of the USE graph from the
module named on the USE statement to its twigs every time a USE statement
is processed.  I've therefore found it useful to move USE statements from
module scope to procedure scope.  This can shorten compile times dramatically.
In one case, from more than twenty hours to less than one minute.  It also
keeps this information out of the .mod file, which means that schemes that
rely on comparing .mod files to avoid compilation cascades don't get confused
when a USE statement at procedure scope gets added, deleted or changed.

BUT, in a module with dozens or hundreds of procedures, it's tedious to put
the same USE statement everywhere, for example to get the kind parameter for
the arithmetic for a class of calculations.

If the procedures in a module share an entity, it necessarily has to be
declared at module scope.  Even if it's private, processors usually put
information about it in the .mod file.  Therefore, if it's changed, even
if it has no effect on the "interface" of the module, schemes that compare
.mod files to avoid compilation cascades get confused.

One could argue "With separate submodules one wouldn't have any need for
contained submodules, so what's the point of allowing them?"  I don't know,
but if we ever want to, any choice other than host association would have
almost surely been the wrong one.

So, as we ponder whether the Modules TR should specify host association or
Lawrie's proposed submodule association relation between a submodule and
its parent, we should keep in mind the effect the choice would have on the
possibilities for future evolution.

I'm not advocating either position here, just pointing out that we need to
think carefully about our choice.

-- 
Van Snyder                    |  What fraction of Americans believe 
Van.Snyder@jpl.nasa.gov       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Sean O'Keefe, George Bush, the Pope, or anybody else.


