(j3.2006) assumed-size poly actual -> non-poly dummy

Aleksandar Donev donev
Fri Jan 28 15:39:34 EST 2011

On 01/28/11 15:17, Robert Corbett wrote:
> An implicit selection is done.  The implicit selection is not prohibited
> by the language of the standard.  An explicit selection is prohibited by
> the standard as written.
I believe you but I do not understand you. What is the rule that 
prohibits an explicit selection, i.e., kills the example below. The rule 
you cited (clause 6.5.2 paragraph 2) does not mention anything about 
components and so I do not understand where this distinction between 
explicit and implicit comes from.

    subroutine sub1(x)
       type(t) :: x(*)
       call sub2(x%i)
    end subroutine

On 01/28/11 15:17, Robert Corbett wrote:
> What is to be gained by allowing x%t where x if of class or type t?
This is a moot point, since I am obviously 5 years late in realizing 
this, but...Nothing is gained in the standard as written. I believe it 
would have been better to require that in your polymorphic example one does:
call sub(x%t)
instead of allowing
call sub(x)
directly when x is polymorphic and the dummy is not. This makes clear 
that a subobject of type t is extracted, just as in the F90 example 
above. It also makes the example covered under the same rules. The 
parent component selection is nothing but a (safe) type cast (up the 
inheritance tree), in fact, that is why it is in the language. It makes 
sense to me that one should be able to cast a polymorphic object into a 
non-polymorphic one, which is what x%t would do if it were 
allowed...SELECT TYPE is used to cast types down the inheritance tree. 
The case of casting to the declared type (the same level of the tree, 
neither up nor down), should be allowed with both the component notation 
and select type.


Aleksandar Donev, Assistant Professor of Mathematics
Courant Institute of Mathematical Sciences
Office: 909 Warren Weaver Hall, New York University
E-mail: donev at courant.nyu.edu
Phone: (212) 992-7315; Fax: (212) 995-4121
Mailing address: 251 Mercer St, New York, NY 10012
Web: http://cims.nyu.edu/~donev

More information about the J3 mailing list