Is using explicit array slice ranges considered bad for Fortran?

I enjoyed reading Dr. Fortran’s post Doctor, it hurts when I do this! - Doctor Fortran. It is amusing and educating.

I was extremely happy to read the following.

One of the big strengths of modern Fortran is its wealth of array-oriented features. Few languages offer the whole-array and array slice operations that Fortran does, and often you can do an array operation without a traditional DO loop. For example, you can add two arrays with:

A = B + C

You can even have functions that return arrays (explicit interface required!), …

I have been told many times that array expressions are not performant, and writing loops is the correct way of handling arrays. I was worried about this at the beginning, but have decided to ignore such advice completely and use array expressions whenever possible. This is what I did when coding PRIMA.

I believe that a language for scientific computing must be able to handle array expressions efficiently, and it should become more and more efficient in this aspect if things are not perfect for the moment. The reason is simple — matrix-vector calculations are the basis of scientific computing.

Let us make the best use of modern Fortran’s “big strength”, and make Fortran even stronger in this aspect.

3 Likes