From owner-sc22wg5@open-std.org  Thu Dec  4 18:55:25 2008
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom7
Delivered-To: sc22wg5-dom7@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 574DBCA5FF2; Thu,  4 Dec 2008 18:55:25 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from nspiron-1.llnl.gov (nspiron-1.llnl.gov [128.115.41.81])
	by www2.open-std.org (Postfix) with ESMTP id 664BFCA5FE7
	for <sc22wg5@open-std.org>; Thu,  4 Dec 2008 18:55:22 +0100 (CET)
X-Attachments: None
Received: from vpna-user-128-15-244-50.llnl.gov (HELO [128.15.244.50]) ([128.15.244.50])
  by nspiron-1.llnl.gov with ESMTP; 04 Dec 2008 09:55:19 -0800
Message-ID: <49381987.3030603@llnl.gov>
Date: Thu, 04 Dec 2008 09:55:19 -0800
From: Aleksandar Donev <donev1@llnl.gov>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071009 SeaMonkey/1.1.5
MIME-Version: 1.0
To: WG5 <sc22wg5@open-std.org>
Subject: Question about Interop TR: assumed-type and polymorphism
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

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@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
