[J3] [EXTERNAL] Elemental type-bound functions not useful

Van Snyder van.snyder at sbcglobal.net
Mon Mar 29 18:44:28 UTC 2021


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/4a88f8c4/attachment-0001.htm>


More information about the J3 mailing list