[J3] [EXTERNAL] Elemental type-bound functions not useful
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Mon Mar 29 19:07:50 UTC 2021
If you don’t want that (and I think there are times when you would), that is precisely what the NON_OVERRIDABLE attribute is for. As I said before, you can’t overload the same name for these types of type-bound procedures anyway (because they are only distinguished by the return type), so just invent a unique name for each subclass that needs this elemental method and make each one NON_OVERRIDABLE.
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: Monday, March 29, 2021 at 2:48 PM
To: j3 <j3 at j3-fortran.org>
Cc: Van Snyder <van.snyder at sbcglobal.net>
Subject: Re: [J3] [EXTERNAL] Elemental type-bound functions not useful
On Mon, 2021-03-29 at 18:25 +0000, Clune, Thomas L. (GSFC-6101) wrote:
Why? The restriction on elemental is that the return type not be polymorphic. There is no restriction that the passed-object dummy be non-polymorphic.
If the dummy argument is polymorphic, the function can be invoked using an actual argument for which the type is an extension of the result type.
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: Monday, March 29, 2021 at 2:18 PM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: Van Snyder <van.snyder at sbcglobal.net>
Subject: Re: [J3] [EXTERNAL] Elemental type-bound functions not useful
On Mon, 2021-03-29 at 12:59 +0000, Clune, Thomas L. (GSFC-6101) via J3 wrote:
I meant to add that the use case you are describing is essentially the poster child for templates vs OO. When the return type varies with the input type, templates are a very natural fit, and trying to force OO is tricky at best.
This doesn't solve the problem unless type-bound functions are allowed not to have polymorphic passed-object dummy arguments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210329/6e20deaf/attachment-0003.htm>
More information about the J3
mailing list