(j3.2006) (SC22WG5.3783) Response on the TR29113 draft N1761

Aleksandar Donev donev1
Tue Dec 9 01:40:39 EST 2008

Reinhold Bader wrote:

> I intuitively 
> followed the otherwise valid
> rule that a CLASS(x) actual cannot ever be matched do a TYPE(x) dummy in 
> formulating my issue.
Except that "*" is not "x", it is a special case, even for CLASS(*) vs 
CLASS(t) in F03. The rule you quote has a very specific purpose, namely, 
safely. You don't want to allow the programmer to pass an apple to 
something that expects a cow and never get a compile or run-time error 
message. If he/she were sure it was an apple, we do allow them to do:

select type(x)
class is(apple)
   call sub(x) ! Safe
class default
   stop "i want an apple!"
end select

In the case of a TYPE(*) dummy, I see nothing that can go wrong when the 
actual is CLASS(*). TYPE(*) is like CLASS(*) [it could be of any type] 
except that a type descriptor is not passed. So one certainly could not 
pass a TYPE(*) actual to a CLASS(*) dummy, but the reverse seems 
perfectly fine and useful to me.

> And the implications of allowing polymorphism here still make me squirm 
> because of
> unintended side effects like having a TYPE(*), VOLATILE dummy and 
> coaxing the external
> mechanism into changing the type  of this object from outside :-)
I will take the smiley face to indicate a joke and not some real fear of 
the impossible.


More information about the J3 mailing list