Allocatable arrays and lower bounds

MATLAB has some nice features, some more related to matrices, than others. I like being able to assign multiple values on the LHS, like “[a,b,c]=[10,20,30]”. . Everyone hates all the strings having to be the same length in a CHARACTER array constructor, and several compilers already allow that as an extension. Some will argue, but it was part of de-facto Fortran to be able to pass scalars to array arguments and to pass arrays of one shape to functions where the argument was of another shape; and I have seen multiple comments about just being able to say something like A=B when A and B are the same size but not the same shape. If A is a vector, which is a common case, A=[B] works, so there is some of that already. Passing different shapes still works without interfaces. It was so common it is very often an issue in “modernizing” old code when you almost always want to place the routines in modules. Even libraries like BLAS still contain routines like DCOPY, which is used in many other libraries for copying data between differently shaped arrays. Not having simple things like .inv. and .dot. standard, so you could say something like .inv.A or B.dot.C, which would allow for mathematical expressions that mapped more directly to standard equation syntax would be nice, and so on. MATLAB, which in some ways was “what Fortran should be doing” for many years, has several other nice syntax features I would not mind seeing in Fortran even today.

1 Like