From J.L.Schonfelder@liverpool.ac.uk Fri Mar 18 11:21:07 1994
Received: from mailhub.liverpool.ac.uk (mail.liv.ac.uk) by dkuug.dk with SMTP id AA04140
  (5.65c8/IDA-1.4.4j for <SC22WG5@dkuug.dk>); Fri, 18 Mar 1994 12:21:10 +0100
Received: from liverpool.ac.uk by mailhub.liverpool.ac.uk with SMTP (PP) 
          id <22480-0@mailhub.liverpool.ac.uk>; Fri, 18 Mar 1994 11:21:09 +0000
From: "Dr.J.L.Schonfelder" <J.L.Schonfelder@liverpool.ac.uk>
Message-Id: <9403181121.AA20939@uxh.liv.ac.uk>
Subject: functions in specification expressions
To: SC22WG5@dkuug.dk (SC22/WG5 members)
Date: Fri, 18 Mar 1994 11:21:07 +0000 (GMT)
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 5113
X-Charset: ASCII
X-Char-Esc: 29

Here is a revised version of the previous paper on this topic
incorporating comments received. Again two versions will be sent
(David, one of these should replace the paper in the existing list.
------------------------------------------------------------
 To: X3J3 and WG5 (15 March 1994)
 From: Lawrie Schonfelder 
  
               User Functions in Specification Expressions
 
 1 Introduction 
 This paper is in response to votes taken on the above topic
 at meeting 128 of X3J3. This meeting favoured allowing user
 defined PURE functions accessed from a module to be used in
 specification expressions. Although it is believed that there
 are as yet unsolved problems with allowing user functions in
 general in specification expressions, there are no
 significant problems with this restricted class of functions.
 
 2 Technical Description    
 The restrictions that are to apply to functions that will be
 permitted to appear in specification expressions are:
   the functions must be declared with the PURE prefix,
   the functions must be directly accessed by use
     association or they must be accessed by host association
     from a host that gained access via use association.
   the arguments of such functions when used in a
     specification expression must be restricted expressions,
   the functions must not appear in any context which
     requires a constant specification expression, e.g. any
     specification not in a subprogram or an interface body,
     in a common or equivalence specification, or a component
     specification, and,
   any object whose specification depends on such a function
     is an automatic object and hence cannot be saved or
     initialised.
 
 3 Suggested Edits  
 The following are suggested edits to implement this change.
 They are written against the current standard. However, this
 area of the text is very complex and subject to major
 redrafting. These edits therefore may well need to be fairly
 comprehensively recast.
 
 3.1 Rationale
 A significant number of useful applications will be
 facilitated by the ability to perform more complicated
 calculations when specifying data objects than are permitted
 with Fortran 90. This will be very substantially achieved by
 allowing a restricted class of non-intrinsic functions in
 specification expressions.
 
 3.2 5.1    [40/41]
 
    Before "If" add the sentence
 A specification expression is considered to be non-constant
 if it involves a reference to a specification function
 (7.1.6.2).
 {{{    I think this edit is sufficient to make any
         object declared with a specification
         involving such a function an automatic
         object. It depends on text which defines an
         automatic object as one that is declared with
         an attribute that depends on a non-constant
         specification expression.                                    }}}
 
 3.3 7.1.6.2    [78/37+]
    Add paragraph
 A function is a specification function if it is a function
 defined with the PURE prefix, is accessible via use
 association or via host association from a host that accessed
 it via use association 
 {{{    This definition allows external procedures
         that are defined entirely independently and
         accessed via an interface block declaration
         in a module. This is slightly wider than was
         discussed at meeting 128 but I can see no
         additional problem caused by this and no
         reason for adopting the more restricted
         definition which confines the specification
         functions to be module procedures.
         Nevertheless this definition ensures that
         there can be no direct or indirect
         interaction between the data environment of
         the specification function and the
         environment established by an invocation of
         the specification expression.                                }}}
 
 3.4 7.1.6.2    [79/16+]
    Add item
    (11)    A reference to a specification function where
             each argument is a restricted expression.
 
 {{{    I believe these edits to be sufficient, in
         spite of how few they seem. Most of the
         essential semantics are already covered in
         the text on pages 78-79. 
        However, it should be noted that as currently
         defined specification expressions are
         excessively constrained. The really important
         restriction is that which distinguishes
         between what can appear in a constant
         compile-time specification and those that can
         occur in a specification that must be
         evaluated at run-time. It might be desirable
         to work through this whole area of expression
         classification making the essential
         restrictions clearer and relaxing the
         inessential.                                                 }}}

-----------------------------------------------------------
-- 
Dr.J.L.Schonfelder
Director, Computing Services Dept.
University of Liverpool, UK
Phone: +44(51)794 3716
FAX  : +44(51)794 3759
email: jls@liv.ac.uk   

