Lets talk about it. You do not like %? Why? Because in some another languages for the same purpose . is used Im disagree with it. I understand that . gives nice vision but Fortran is not C-kind language like C++, C#, Java and so on. I think it is not correct to use dot in this kind of case. If you have a look to ISO/IEC 1539-1:2004(E) youll find that even there dot isnt used for this:
6.1.2 Structure components
A structure component is part of an object of derived type; it may be referenced by an object
designator. A structure component may be a scalar or an array.
R612 data-ref is part-ref [ % part-ref ] ...
R613 part-ref is part-name [ ( section-subscript-list ) ]
C609 (R612) Each part-name except the rightmost shall be of derived type.
C610 (R612) Each part-name except the leftmost shall be the name of a component of the declared
type of the preceding part-name.
C611 (R612) If the rightmost part-name is of abstract type, data-ref shall be polymorphic.
C612 (R612) The leftmost part-name shall be the name of a data object.
C613 (R613) If a section-subscript-list appears, the number of section-subscripts shall equal the rank
Why so? I do not think its because of conservatism. Fortran is Fortran and we cant sometimes just simply add new feature from another language even dot. I prepared code for this. Lets see:
module VectorType implicit none type Vector integer N type(log), pointer :: or end type Vector type log type(Vector) vect2 end type log interface operator( .or. ) module procedure OrVectors end interface operator( .or. ) contains function OrVectors( vect1, vect2 ) type(Vector) :: OrVectors type(Vector), intent(in) :: vect1, ve ct2 OrVectors%N = vect1%N + vect2%N !vect1%N = 3 -- not pass !vect1.N = 3 -- pass! end function OrVectors end module VectorType program Test use Modul implicit none type(Vector) vect1, vect2, vect3 type(log), target :: logic vect1%N = 1 vect2%N = 2 logic%vect2%N = 4 vect1%or => logic vect3 = vect1.or.vect2 print *, vect3%N read * end program Test
What does mean there vect1.or.vect2? Operation or components selection? IFC chose the second and have printed 4. But what if I wanted to use overloaded operator .or. which must give in result 3! So using dot in this use case are corruptly.
And notice the comments: !vect1%N = 3 -- not pass and !vect1.N = 3 -- pass!. This some kind of bug.