Subject: Mapping of Pointers

From: [email-masked] (Jeanne Martin)
Date: Thu, 7 May 92 15:55:48 PDT

Mary Zosel asked me to review some of your recent messages on the mapping of
pointers.  I am a long-time member of X3J3, Convenor of WG5, and the author
of the pointer proposal that was eventually adopted.  (That doesn't mean I like 
everything about it; in a standards committee you have to make compromises.)
I am also a long-time LLNL employee.

Fortran programmers at LLNL have had access to pointers (of the "Cray" pointer
flavor) for some 20 or more years and have become strong proponents of
dynamically-sized programs.  There are extremely few arrays anymore whose
sizes are declared at compile time.  If LLNL programmers want to change
the extents of arrays, they just read different sizes into the executing code;
they don't change the values of parameters and recompile before executing the
code.  I expect Fortran 90 programmers, once they have this facility, will
jump on the same bandwagon.  Thus you must allow the distribution of dynamic
arrays (array pointers) since "static" arrays may cease to exist.

I also think that pointer aliases will be heavily used, since triplet notation
is hard to read and thus maintain.  For example, would you rather see

	c = a(2:n-1, 2:n-1) * b(2:n-1, 2:n-1)

or

	c = inner_a * inner_b

where, of course

	inner_a => a(2:n-1, 2:n-1)
	inner_b => b(2:n-1, 2:n-1)

Pointer aliases may involve strides, so if the pointer target is distributed,
some particular pointer alias may undo the usefulness of the distribution.
For example, if you have 32 processors and you distribute on allocation:

	allocate (x(1:33, 1:33))
	corners => x(1:33:32, 1:33:32)
	corners = corners * two_by_two

You may want the ability to redistribute the target or you may assume such
usages will be rare and not worth supplying means to make them efficient.

It is true that different pointer functionality is needed for use with derived
types to create lists, trees, etc. than is needed for arrays, but one of the
design criteria for F90 pointers was that there be a single pointer facility
that was integrated with both functionalities.

In Fortran 90, a structure (object of derived type) is thought of as one
(unspecified) storage unit, but if the structure contains a pointer, the
target of the pointer could be distributed when it is allocated.  Note that
structures cannot contain allocatable arrays.

In your place, I would ignore allocatable arrays; they provide only a subset
of the functionality of pointers.  (For this reason, I removed them in my
original pointer proposal, but some people felt allocatable arrays were
easier to understand than pointers and some vendors had already implemented
allocatable arrays, so I was outvoted.)

I have joined the hpff-f90 mail group so I will see any subsequent messages,
but in any case my address is below.

Jeanne Martin
[email-masked]