Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

F2003 vs. F2008 OOP comparison

Johannes_Rieke
New Contributor III
360 Views

I'm looking for a good source for OOP examples where the new capabilities of F2008 (F2015?) are shown in contradiction to F2003. I found some information in this sources:

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/559996 and certainly here https://software.intel.com/en-us/blogs/2013/12/30/doctor-fortran-in-its-a-modern-fortran-world and https://groups.google.com/forum/#!topic/comp.lang.fortran/kiGbkjR-Ksc.

Does anyone know, which of the 'newer' books cover the differences?

Many examples are based on F2003 and it would be good to know, how they could be realized with F2008/2015 capabilities.

Thanks, Johannes

 

0 Kudos
3 Replies
FortranFan
Honored Contributor II
360 Views

Both Fortran 2008 and Fortran 2015 were viewed as "minor" revisions to the standard though with the introduction and/or changes to coarray feature, enhanced interoperability with C, submodules, etc. some have a different take on the versions.

But the adjective does seem to apply to many aspects of the language including facilities toward object-oriented (OO) programming.  The links you have added to the original post cover any facilities included and as such, they are the good resources you seek.  If one were to try to spike anything out, it will be the "polymorphic assignment" aspect introduced with the Fortran 2008 revision.  See a recent thread on this:

https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/741432

And there is the aspect of allocatable components of recursive type which can help with OO based design on stack type of containers that can help avoid the issues one might face with components having POINTER attribute.

Overall though the OO-specific features in Fortran 2008 are rather limited (and even more so with 2015), it will be the smallest of chapters in a book I feel if one were to try to present them as such.  Metcalf et al. in Modern Fortran Explained cover all this under a few subsections in their last chapter 20 on miscellaneous enhancements.

0 Kudos
Steve_Lionel
Honored Contributor III
360 Views

I pretty much agree with FortranFan - probably the biggest change was being allowed to do intrinsic assignment of polymorphic entities.  On https://wg5-fortran.org/f2008.html are links to two documents by John Reid on the new features of F2008.

0 Kudos
Johannes_Rieke
New Contributor III
360 Views

Dear FortranFan and dear Steve. Many thanks for your feedback and the additional links. It is good to know, that F2003 was the big step for OO features and that the examples for OOP in F2003 are a good starting point. So one step a time, I will have to work through the examples and literature mentioned above and then will have a deeper look on "polymorphic assignment" and "allocatable components of recursive type". Avoiding pointers is a good goal for avoiding memory leaks if one forgets a finalizer.

Thanks, Johannes

0 Kudos
Reply