From JANSHEP@torolab2.vnet.ibm.com Sun Jul  3 07:54:58 1994
Received: from vnet.ibm.com by dkuug.dk with SMTP id AA22832
  (5.65c8/IDA-1.4.4j for <sc22wg5@dkuug.dk>); Sun, 3 Jul 1994 17:56:03 +0200
Message-Id: <199407031556.AA22832@dkuug.dk>
Received: from TOROLAB2 by VNET.IBM.COM (IBM VM SMTP V2R2) with BSMTP id 8932;
   Sun, 03 Jul 94 11:55:28 EDT
Date: Sun, 3 Jul 94 11:54:58 EDT
From: "Janice Shepherd" <JANSHEP@torolab2.vnet.ibm.com>
To: sc22wg5@dkuug.dk
Subject: Generic Dummy Procedure Arguments
X-Charset: ASCII
X-Char-Esc: 29

>
> To: X3J3 and WG5 (30-May-94)
> From: Lawrie Schonfelder
> References: none
                           Generic Dummy Procedures

> 1 Introduction
> The question of dummy procedures where the specific name passed
> was that of a member of a generic set with the same name has been
> raised recently on the network.  The request made as a
> requirement was that user generic procedures should be treated
> similarly to intrinsic procedures, viz. that as the specific
> procedure name SIN can be passed as an actual argument to a dummy
> procedure this capability should also be allowed for a user
> defined procedure whose name was both that of a specific
> procedure and a whole generic set.  In this paper I would like to
> propose a much more radical but also more useful extension.  I
> believe that with very little actual change to the language we
> could, and indeed should, allow the declaration of generic dummy
> procedures and hence allow generic names to appear as actual
> arguments.

<text deleted>

I think a slightly different syntax will be needed. In Fortran 90
one can already have dummy procedures that are defined by
interface bodies within a generic interface with the same name.
Thus a statement such as
   GENERIC dummy-arg
will be needed to distinguish these new dummy generics from the
existing dummy procedures.

Here is an example of what is already permitted in Fortran 90.
     program xx
       interface
         subroutine mysub(a,b)
         end subroutine
       end interface
       call mysub(1.1,2.2)
       call sub(mysub)
       contains
        Subroutine sub(dummy)
          interface dummy
            subroutine other()
            end subroutine
            subroutine dummy(a,b)
            end subroutine
          end interface
          call dummy()
          call dummy(1.2, 3.2)
        end subroutine
       end

With this example the specific routine 'mysub' is being passed
to the specific routine dummy which is also the name of an interface.

I would envision that a new "GENERIC" statement could be used as
follows:
     program xx
       interface mysub
         subroutine mysub(a,b)
         end subroutine
         subroutine another()
         end subroutine
       end interface
       call mysub(1.1,2.2)
       call sub(mysub)
       contains
        Subroutine sub(dummy)
          GENERIC dummy          ! shows that a GENERIC interface is
                                 ! expected
          interface dummy
            subroutine other()
            end subroutine
            subroutine dummy(a,b)
            end subroutine
          end interface
          call dummy()
          call dummy(1.2, 3.2)
        end subroutine
       end

The GENERIC statement would have to be included with the explicit
interface.


Janice C. Shepherd
