These are some initial impressions of Fortran 2008 as seen by a MATLAB person.
Very generally, I would say Fortran is quite similar to MATLAB (I know that it's actually the other way round). Apart from this, here are some language features that I found quite interesting/quirky/nice/annoying (in no particular order):
- Implicit typing:
- Implicit typing in Fortran has nothing to do with modern type inference (a-la
auto
in C++11)! If it is active, the compiler tries to assign types based on variable names. 😱 So it is really necessary to always use implicit none
.
- Array indexing:
- Can be specified by the programmer, e.g. one can start indexing with
0
or even use negative indices. On the other hand: Prepare to memorise scenarios in which indices are remapped to 1:N
by default and a couple of cases when indices remain the same.
- MATLAB slices are specified as
<lower bound> : <step size> : <upper bound>
, whereas Fortran uses ` :