[J3] [EXTERNAL] Can a type-bound procedure be passed as an actual argument
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Fri Jan 13 14:19:49 UTC 2023
I think this approach only solves the problem of disambiguation for the passed-object dummy argument. Many type-bound procedures are generic and there would still be ambiguity when attempting to use them as a procedure argument. I suppose not so different than what happens with specific and generic procedures, but somehow here it feels too-little-bang-for-the-buck.
From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Thursday, January 12, 2023 at 5:28 PM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: Van Snyder <van.snyder at sbcglobal.net>
Subject: Re: [J3] [EXTERNAL] Can a type-bound procedure be passed as an actual argument
On Thu, 2023-01-12 at 09:55 +0900, Malcolm Cohen via J3 wrote:
Type-bound procedures are invoked through an object. You can’t do that unless you have the object. Dynamic dispatch needs the object!
...
It’s the same with generics (which are static dispatch); if the specific procedure name is not public, you cannot pass it as an actual argument.
Several years ago, I proposed a method to do generic resolution for a generic procedure without invoking it, to assign the specific procedure to a procedure pointer or use it as an actual argument.
A similar scheme could be used for dynamic dispatch, and to attach a passed-object dummy argument, without invoking the procedure, to allow it to be assigned to a procedure pointer or used as an actual argument.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230113/6ee4fee5/attachment.htm>
More information about the J3
mailing list