Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!lll-tis!ohlone!nelson
From: nelson@ohlone.UUCP (Bron Nelson)
Newsgroups: comp.lang.fortran,comp.lang.pascal
Subject: Re: ALLOCATABLE, ARRAY :: A(:)
Message-ID: <253@ohlone.UUCP>
Date: Wed, 15-Jul-87 19:43:05 EDT
Article-I.D.: ohlone.253
Posted: Wed Jul 15 19:43:05 1987
Date-Received: Sat, 18-Jul-87 03:27:13 EDT
References: <1215@batcomputer.tn.cornell.edu> <105@anumb.UUCP> <3538@watvlsi.UUCP> <3247@cit-vax.Caltech.Edu>
Organization: Cray Research Inc., Livermore, CA
Lines: 36
Summary: It can be done
Xref: mnetor comp.lang.fortran:165 comp.lang.pascal:202

In article <3247@cit-vax.Caltech.Edu>, walton@tybalt.caltech.edu (Steve Walton) writes:
>                                Can you send an ALLOCATE'd array to a
> separately compiled Fortran-77 subroutine in which the corresponding
> dummy argument is not ALLOCATABLE?  Can you DEALLOCATE an array within
> a subprogram which was ALLOCATE'd by the caller, and vice versa
> (provided, of course, that the dummy argument is ALLOCATABLE)?

Although this article asks this question specifically about the Alliant
compiler, we both have been having trouble seeing how this can be done
at all by anybody.  After careful reading of the proposed standard, I think
I now understand how this can be done in a sensible way (and of course,
I feel stupid for not noticing it sooner).

The trick is that in order to use any of the fancy features of 8x, the
called procedure MUST have an explicit procedure interface definition.
Thus the calling procedure CAN tell at compile time what the called
procedure expects to recieve.  Thus, foo(a(5:10)) and foo(a(5)) are
NOT both legal; if routine foo expects an array section, all callers of
foo must include foo's interface definition, and so foo(a(5)) will give
an error.  Similar restrictions apply to the use of allocatable arguments
that will be (de)allocated by the called routine.  If the caller lacks
an interface definition for the routine to be called, it can pass arguments
according to the Fortran77 rules.

This example goes a long ways towards pointing out that 8x is not just
an extension of Fortran, it is a new and different language.  The standards
committee has done a good job of making sure the two languages can co-
exist, but they do not really "mix" very smoothly.

Anyway, sorry for the confusion.  Hope this is of use.

-----------------------
Bron Nelson     {ihnp4, lll-lcc}!ohlone!nelson
Not the opinions of Cray Research
I don't know what language I'll be writing a compiler for in '88,
but I know it will be called Fortran.