JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for COMP-FORTRAN-90 Archives


COMP-FORTRAN-90 Archives

COMP-FORTRAN-90 Archives


COMP-FORTRAN-90@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Monospaced Font

LISTSERV Archives

LISTSERV Archives

COMP-FORTRAN-90 Home

COMP-FORTRAN-90 Home

COMP-FORTRAN-90  1997

COMP-FORTRAN-90 1997

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

wish list of fortran features

From:

"Dr W.W. Schulz" <[log in to unmask]>

Reply-To:

Dr W.W. Schulz

Date:

Sat, 8 Nov 1997 17:10:40 +0000 (GMT)

Content-Type:

TEXT/PLAIN

Parts/Attachments:

Parts/Attachments

TEXT/PLAIN (311 lines)

General Remarks:

    These are some wishes that I see as useful from my own programming
    experience. Of course, not everybody will agree with this rather
    personal list of wishes. I am ignorant about other proposals
    for F2000. Maybe I am duplicating here. Maybe some things
    are too difficult to implement and there are reasons why it
    might be dangerous.

    In any upcoming new standard for Fortran any suggested additions
    should be checked whether they enforce or at least encourage these
    points:
      -safety
      -reliability
      -transparency
      -portability
      -avoiding redundancy
      -compatibility with F77 if it is shown not to clash
       with the above
      -new powerful abstractions, esp object-oriented facilities

     F2000, F90, F95, F77 are the common abbreviations.

Features on my wishlist:

(o) Status of pointers/allocatable arrays:
    Pointers should be either associated or disassociated.
    Dangling pointers should be caught by the system.

(o) Pointers:
    allow pointers to have user-set indices:
        A(0:20) => A_Target(20:40)
    or A( :20) => A_Target(20:40)
    or A(0: ) => A_Target(20:40)
    Pointers (at least the aliasing pointers) are for the
    convenience of the user, this should be enhanced as much
    as possible

(o) Pointers to real/imaginary part of complex numbers
    There is definitely a need to be able to address the
    real and imaginary parts of complex numbers with pointers.
    In practice the F77 way of using code is like this

       Complex AB(100)
       ...
       CALL DOIT( AB )
       ...
       SUBROUTINE DOIT( AB )
       Real AB(*) ! This is now 2*100 Reals with
                             ! Order Re(1),Im(1),Re(2),Im(2),...
       ...
       END

    This is not very transparent, but a necessity if one wants
    to treat real and imaginary part separately. Just take a look
    at FFTs to see why (save on operations).
    In F2000 I would like to see something like

      Complex, TARGET :: C(100)
      Real, POINTER :: R(:), I(:)
      ...
      R => REAL( C )
      I => AIMAG( C )

      or other ways of directly addressing the two components
      as one can do with user-defined types.

(o) The usefulness of RESHAPE and PACK is that it moves the
    burden of indexing from the user to the compiler. This would
    further enhanced by allowing a pointer to point to such a
    structure:
        Real, TARGET :: T(:)
        Real, POINTER :: P(:,:)
        P => RESHAPE( T, (/N,M/) )

   In practice this is done very often in F77 by passing an array
   into a subroutine where the array is declared with different
   rank.
   The pointer arrangement would be more transparent and safer.

(o) enumerated Type:
    Ada, C/C++, etc have it. It is a very useful and concise way
    to set up a list of options etc.
    It is always better to refer to options/constants by name
    rather than by number as frequently done in old F77 codes
    In F90 one cannot easily collect these options/constants into
    one structure.
    Example:
       TYPE(Enum) :: Weekdays(0:6) = (/Sun,Mon,Tue,Wed,Thu,Fri,Sat/)
    Now one use either Weekdays or directly Sun, etc.


(o) OO Features:
    The introduction of user-defined types (ADTs)
    has been a great step forward for Fortran but currently any
    addition to a type involves the cumbersome introduction of
    subtypes, just try to translate the 'standard' examples
    of person --> student --> graduate student into Fortran90.

    A good OO implementation should be implemented asap.
    There are some good and not so good OO languages out there
    (Eiffel, Beta, Python, etc) and one should learn from them
    what to do and what to avoid.
    There is also some danger that Fortran becomes slowly obsolete
    as fewer and fewer people learn it since it has the notion of
    an old-fashioned language.
    Of course, there will be traditionalists that will 'object' to
    this, but there are so many cases where it is useful, so why
    wait any longer?

(o) Shortening of Fortran
    I think there are many instances where the style of programming
    could be enhanced by allowing more concise statements,
    e.g. ALLOCATE( X(1:N)=Zero ) allocates an array X(1:N) and sets
    all elements to Zero.
    The parameter list of Subroutines and Functions could have
    the declarations of their arguments directly there:
    SUBROUTINE SUB( Integer, INTENT(IN) :: A &
,Real, INTENT(IN OUT) :: B &
                  )
    instead of repeating it again. It is also less error prone
    (though most compilers will pick it up).


(o) ASCII characters:
    It is about time to allow for a truly international use of characters.
    The latin-1 (better the unicode ISO 10646) should be mandated asap.
    The old ICHAR,CHAR intrinsics should become obsolete. There is no need
    to support two different character sequences for only historical reasons.

    I hear that something along these lines is being proposed already.

(o) Extension of CASE:
    The current version of the CASE statement is a somewhat inconsistent
    with the rest of the language. It is a much needed improvement of
    the IF-block but has been defined, im my opinion, in the wrong way.

    A more useful form is:
    SELECT CASE( A )
           CASE( r1<=A<r2, r3<A<=r4, r5,r6,r7 ) ! r stands for range
               ...
           CASE( r2<=A<r3, r8,r9 )
               ...
           CASE DEFAULT
    END SELECT
    where A can be integer or real or character(ASCII).

    The CASE construct is closer to IF-blocks than array indexing
    and this should be reflected.
    In addition, the range expressions should be allowed in IF
    statements as well. (FORTRAN=FORmula TRANslation, remember?)
    I.e. IF( Zero<=X<Two ) THEN
    instead of
         IF( Zero<=X .AND. X<Two ) THEN

(o) EXITs:
    allow exits from any block structure not just DO loops
    this would make goto even rarer.
    But do not ban GOTO's and CONTINUE completely, they are useful
    in -admittedly- rare cases.

(o) Modules:
    Though the Fortran Standard Committees do not like to get involved
    in matters of operating systems etc. there is a need to solve the
    MODULE problem: different compilers use different ways of providing
    the interfaces of modules during compilation (files .mod, .kmo, .o)
    This can make the porting of code utilities (makefiles) across
    platforms difficult.
    Secondly, there is the compilation cascade when the implementation
    of a module is changed but not its (public) interface.
    These matters leave room for improvements that have to be addressed
    soon.

    In addition, does the current standard say anything about this:
    Modules A, B, C
    B: use A
    C: use B ! is A also visible in C through B?


(o) Libraries:
    The step to include a string type (ISO_VARYING_STRING) is a good
    step and should used more often. Common data structures (such as
    linked lists, trees, heaps, etc) could be provided to reduce
    duplication of code, enhance safety, etc. or, at least provide
    us with model implementations that can be copied.


(o) Obsolete Features:
    - specific intrinsics and all the restrictions that come with them
             Do we really need ABS,IABS,DABS,CABS, ...
             (use generics)
    - Proposal: change AIMAG to IMAG to be consistent
    - DOUBLE PRECISION (use Real(kind=...))

    - PRINT (use WRITE)
    - NULLIFY (With the NULL in F95 NULLIFY becomes redundant.)

    - Restrictions on internal files (free format,namelist)
      This is really an annoying restriction. Anyone who has tried
      a tiny bit of text processing in Fortran will agree. Often, to be
      conforming with the language, one has to use SCRATCH files
      instead.

(o) Continuation Lines
    Why is it necessary to have an extra ampersand (&) in front of
    formatting statements in READ/WRITE calls?
    E.g. my DEC compilers complains about
    Write(I_OUT, '( " some Variable",I4 &
/" another one ",I4 &
                  )') I,J
    and wants
    Write(I_OUT, '( " some Variable",I4 &
& /" another one ",I4 &
                  & )') I,J
    I don't like to have two rules for continuation lines. Just disallow
    to break strings into two lines without quotes around them.
    Secondly why not allow an & either at the end or the beginning of line
    to indicate that is a continuation.

(o) IMPLICIT NONE
    It would have been a good idea to make this the default
    setting for F90 code in recommended format (i.e. free format)
    True it makes F77 and F90/95 a little bit imcompatible
    but safety should take priority.

(o) SAVE
    For the sake of transparency, variables should be saved between
    function calls only if they are declared with the attribute SAVE
    not just when initialized.
    This is, however, in conflict with the earlier standards.

(o) PARAMETER Variant:
    I have wished many times to have a variable that can only be
    declared once at the beginning of a programme and remains constant
    throughout.
    (setting options is a typical example)

(o) Overloaded Operators
    allow commutative operators to reduce duplication of coding
    Also, allow to declare some operators invalid for ADTs. There
    are times when I don't want an assignment of the intrinsic kind.

(o) Access to OS
    there should be some simple and STANDARD form of accessing the
    operating system and results from those operations
    CALL OP_SYS( ... )

(o) bindings to other languages
    I hear they are woorking on C <--> Fortran

(o) private/public Types
    Are there still compilers (e.g IBM's xlf, Hitachi's f90) around
    that have problems with type declaration of the code below.
    Just try the following example with f90 -c and see whether
    your compiler complains about the TraceList TL being private
    I am not sure what the F90 standard has to say about this but
    common sense tells me that Module B cannot redeclare the definition
    of the TYPE TraceList, that can be done only by Module Tracing.
    However, any variable declared in B can be private, but not
    dummy arguments in the parameter list of subroutines/functions.
    If necessary the standard should be reformulated.

    MODULE Tracing
       TYPE TraceList
            Integer :: Depth_of_Calls
       END TYPE TraceList
    END MODULE Tracing

    MODULE B
      USE Tracing
      PRIVATE
      PUBLIC :: Sub_B
      ! If there is a problem, try to use the next Line instead
      ! PUBLIC :: Sub_B, TraceList

    CONTAINS

      SUBROUTINE Sub_B( TL )
          Type( TraceList), INTENT(IN OUT) :: TL

          ! Entering Subroutine
          TL%Depth_of_Calls = TL%Depth_of_Calls +1

          ! .. ! do something

          ! Leaving Subroutine
          TL%Depth_of_Calls = TL%Depth_of_Calls -1
      END SUBROUTINE Sub_B

    END MODULE B


I hope this will stimulate some discussion about the
next Fortran version (if it's not too late) and
hopefully will include some of my wishes.

WS
-----------------------------------------------------------------------
| Werner W Schulz |
| Dept of Chemistry email: [log in to unmask] |
| University of Cambridge Phone: (+44) (0)1223 336 502 |
| Lensfield Road Secretary: 1223 336 338 |
| Cambridge CB2 1EW Fax: 1223 336 536 |
| United Kingdom WWW: |
-----------------------------------------------------------------------




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
February 2023
November 2022
September 2022
February 2022
January 2022
June 2021
November 2020
September 2020
June 2020
May 2020
April 2020
December 2019
October 2019
September 2019
March 2019
February 2019
January 2019
November 2018
October 2018
September 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
April 2015
March 2015
January 2015
December 2014
November 2014
October 2014
August 2014
July 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
July 2013
June 2013
May 2013
April 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
August 2010
July 2010
June 2010
March 2010
February 2010
January 2010
December 2009
October 2009
August 2009
July 2009
June 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1997


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager