I recently used the term "Fortran idioms" or possibly "idiomatic Fortran" on comp.lang.fortran and someone commented that they weren't sure such a thing exists, which makes me think that it should exist if it doesn't. I see the term "idiom" in discussions of common practices in other languages. I interpret it as being the common way one does things when she really knows the language's full range of capabilities and chooses the most powerful or succinct or transparent and expressive way to accomplish the goal. By comparison, there's a whole book on writing idiomatic Python.
I think of idiomatic Fortran as using things such as array constructors to do in one line what would require a loop in some other languages:
real, allocatable :: positive_integers(:)
positive_integers = [(i,i=1,100)]
Is there such a thing as idiomatic Fortran?
Would it be another reasonable name for "Best Practices"?
Are there other examples of practices you would consider to be natural idioms that an experienced Fortran programmer might use, but that a newcomer to the language -- especially one whose primary experience is in one of the other common scientific programming languages -- would likely do in a less elegant way?
Damian
I recently used the term "Fortran idioms" or possibly "idiomatic Fortran" on comp.lang.fortran and someone commented that they weren't sure such a thing exists, which makes me think that it should exist if it doesn't. I see the term "idiom" in discussions of common practices in other languages. I interpret it as being the common way one does things when she really knows the language's full range of capabilities and chooses the most powerful or succinct or transparent and expressive way to accomplish the goal. By comparison, there's a whole book on writing idiomatic Python.
I think of idiomatic Fortran as using things such as array constructors to do in one line what would require a loop in some other languages:
real, allocatable :: positive_integers(:)
positive_integers = [(i,i=1,100)]
Is there such a thing as idiomatic Fortran?
Would it be another reasonable name for "Best Practices"?
Are there other examples of practices you would consider to be natural idioms that an experienced Fortran programmer might use, but that a newcomer to the language -- especially one whose primary experience is in one of the other common scientific programming languages -- would likely do in a less elegant way?
Damian