Which five features should Fortran 202Y implement?

Here is a list of ideas:

and you can propose more if your idea is not on the list.

Then each member of the Fortran Committee proposes 5 features they would like to see. To begin the “down select” discussions.

What five features do you want me/us to represent?

It seems the top two for me would be:

As in my opinion these are needed for a longevity of Fortran.

The other three might be issues that I see every single newcomer to hit:

These are not as critical, as it should be possible to catch or workaround with a good compiler (with warnings and/or errors), but I think it would still be good to just make the standard itself not even allowing these in the first place.

There are more people on this forum who are part of the committee, so more than 5 features can be added.

Let me know your thoughts.

11 Likes

My top 3 would be (in order of importance to me)

  1. Better generics (something I think we all agree on)

  2. A standardized and transportable module format to eliminate the need to compile different versions of say MPI for example if you want to USE mpi08 etc. I doubt this will ever happen though but it would make building libraries that can be used by any compiler a lot easier.

  3. Eliminate the need for implicit NONE one way or the other.

I see the need for better error handling. It’s just not as important for me as my top 3.

Edit

Outside of error handling, the only other things I would like to see are a couple of small cosmetic changes that I think would be trivial to implement

  1. Eliminate the need to prefix CALL to every subroutine reference when an explicit interface exists for the subroutine. This is aimed at newcomers who are used to the way every other major language references a void function (AKA subroutine)

  2. Add a deallocate option to allocate that says if something in the allocate list is already allocated, go ahead and deallocate it for me and reallocate to my requested new size. This would save the extra code required to check for allocation with an if (allocated()) statement.

4 Likes
  1. implicit line continuation
  2. intrinsic functions providing a standardized modern interface to blas/lapack
  3. namespace

And also, the three newcomer confusions mentioned in the main post. I have accepted to live with them, but they are major obstacles for new users due to their weirdness and lack of documentation. Getting rid of them may be more important than introducing new features in terms of boosting new user adoption.

3 Likes

For me, new features would be

  1. Namespaces: Namespaces · Issue #87 · j3-fortran/fortran_proposals · GitHub)
  2. Better error handling (not necessarily exceptions): Namespaces · Issue #87 · j3-fortran/fortran_proposals · GitHub
  3. Generics

and in addition I would like to see changes for the behavior related to

  1. implicit typing: Eliminate implicit typing · Issue #90 · j3-fortran/fortran_proposals · GitHub
  2. precision handling, e.g. removing the constraint that the default integer and the default floating point representation need to occupy one “storage unit”
3 Likes
  1. Generics
  2. Namespaces
  3. Better error handling
  4. Unsigned integers
  5. Default values for optional arguments
4 Likes
  1. Generics
  2. Allow setting default value for optional dummy argument
  3. Namespace for modules
  4. Array of strings (or intrinsic string type)
  5. Deprecate and remove implicit save behavior

If more than 5 can be suggested, I definitely agree with the remaining 3 proposed by @certik in his first post. Namely,

3 Likes

28 posts were split to a new topic: Implicit typing and backwards compatibility

Here are some things I think would be useful:

  1. The ability to initialize an allocatable entity at its declaration.

  2. The ability to transfer attributes between POINTER and ALLOCATABLE entities. This might be done by extending MOVE_ALLOC() to allow pointer arguments.

  3. Allow expression evaluations in input for NAMELIST and possibly LIST-DIRECTED I/O.

  4. An intrinsic bit data type.

  5. Standardize a cpp-like preprocessor.

  6. Allow allocatable entities to be allocated and defined within i/o statements. This would allow, for example, an array of unknown size to be simply read in a natural way.

As far as I know, none of the above would break backward compatibility, they are all extensions of the language beyond its present limits.

1 Like

My list at the moment is:

These are the features directly preventing me from implementing certain frameworks/libraries in desired ways.

1 Like

As discussed in A shorthand for immutability · Issue #221 · j3-fortran/fortran_proposals · GitHub, I would like end associate to be made optional. The association would end at the end of a program unit. If associate were streamlined in this way, it might be used more often, and a large fraction of declarations would be unnecessary, giving Fortran some of the convenience of Python/Julia/Matlab/R. By associating a name to an expression one can generalize the concept of the named constant (parameter), which must be known at compile time.

It feels weird without the matching end associate. Why not simply put all the expressions in one parenthesis?

That is not allowed if one association depends on another one. For example, you cannot write

associate (x => 2.1, xsq => x**2)

namespace +1

Is it possible to allow this? In languages like R, this is allowed since codes are evaluated from left to right.

https://stackoverflow.com/questions/tagged/fortran?tab=Frequent

Out of the 15 most frequent Fortran questions on Stack Overflow, three are related to data type. The 1st and 2nd are about kind, and the 13th is about double precision.

Since Fortran is a compiled language, the first thing a newcomer needs to learn is the data type. I personally believe this confusion in the first step has driven away many potential users and given many more a wrong impression about Fortran. Instead of making any breaking changes, having better tutorials is much easier and more efficient.

1 Like

Hmmm, the problem is next week my list will be different. Depending on what has happened recently it might be weighted towards parallelism or more intrinsics or … But for the moment at least

  • additional intrinsic types – intrinsic lists, arrays of string type
    with varying length, and unsigned integers and/or a bit type (given an
    retro unsigned integer could be a lot of work for compiler developers)
    like LOGICAL used to be on some platforms.

  • Block text for defining character arrays and comments

  • Namespace for module entities (where a module name can be used as
    a prefix) and automatic generics for name collisions from two modules
    when the procedures are distinguishable by their interfaces

  • Default value specification in the procedure definition that is NOT
    implicitly saved, as in

    subroutine a(par1=10,par2=[10.0,20.0,30.0])

    that uses the same syntax as NAMELIST groups for defining user types and repeats,
    with the difference that allocatable entities could be given defaults,
    which would be used for unallocated dummy arguments or intent(out) intents.

  • standardized basic LA and low-level graphics libraries

Others …

  • namespace access for at least some variables combined with allowing
    expression evaluation, and ability to ignore unused values in NAMELIST
    and write partial NAMLIST groups based on an argument list, like “write(,nml=big) a,b,c"
    or even something more like a USE statement "write(
    ,nml=big) only :: a,b,c”

  • Standardized preprocessor.

Regarding personal solutions to some of the questions/comments above

How to flag not to use deprecated features:

As a suggestion, I personally use the name of the standard not to say to
enforce that standard, but to enforce not using everthing deprecated by
that and previous standards, plus being free-format and having an implied
“implicit none”.

I make the first line !standard, ie. “!f2018” and use that as
a flag to turn on compiler switches for everything deprecated by that or
previous standards (it uses the file(1) command and a magic file on *nix
systems and a simple wrapper). All the compilers I use have a switch
to assume “implicit none”, very long or unlimited line length, and so on.
Not perfect, but handy. If there were a “–no-deprecated=f2020” switch
that vendors would support that would be nice.

1 Like

1.Array interation. for loop · Issue #241 · j3-fortran/fortran_proposals · GitHub
2.change default constant kind to real(8) or infinite. Default KINDs for constants and intrinsics · Issue #78 · j3-fortran/fortran_proposals · GitHub
3. remove implicit save behavior. Deprecate and remove implicit save behavior
4. pattern matching. Unpacking variables from arrays · Issue #186 · j3-fortran/fortran_proposals · GitHub

2 Likes

My preference would be:

  1. Generics
  2. Somehow fix the issue of mixed precision
  3. A standardized and portable module format
  4. multiline string support, something like Python docstrings (highly useful when combined with preprocessing for multilingual coding and library documentation):
character(:), allocatable :: multiline
multiline = """
s
t
r
i
n
g
"""

Thank you, @certik, and all (committee members and community volunteers) for your active role in formalizing and making progress on these enhancements.

4 Likes
  • string handling through intrinsic procedures.
1 Like
  1. Generics;
  2. Default implicit none;
  3. Namespaces;

Optional:

  1. Real numbers default to double precision;
  2. Built-in data structures: Hash table (map).
3 Likes