(j3.2006) (SC22WG5.3738) Question about Interop TR: assumed-type and polymorphism

Aleksandar Donev donev1
Thu Dec 4 12:55:19 EST 2008


Hi,

N1761 says:
"In the association of actual and dummy arguments, an assumed-type
dummy argument is type and kind compatible with an actual data
argument of any type."

Is the following intended to be legal:

interface
   subroutine sub(x)
     type(*) :: x
   end subroutine
end interface

CLASS(*), pointer :: x
... ! Point x to something
call sub(x) ! Legal?

I would love to be able to write code like this:

subroutine process_me(x)
   class(*), dimension(..), intent(inout) :: x

   if(type_is_interoperable(x)) then
      call c_routine(x) ! pass a descriptor along
   else
      stop "non interoperable type"
   end if
end subroutine

Would it be feasible to add an intrinsic type_is_interoperable? It does 
not seem hard to me to add that as a field in the type table, but maybe 
I am wrong...

Thanks,
Aleks

-- 
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ LLNL
High Performance Computational Materials Science and Chemistry
E-mail: donev1 at llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev



More information about the J3 mailing list