[J3] [EXTERNAL] Re: 21-144r2

Magne Haveraaen Magne.Haveraaen at ii.uib.no
Wed Jun 23 22:04:01 UTC 2021


Sorry I will miss the discussion of this paper, it will be too late for me - Magne

> 22. jun. 2021 kl. 15:35 skrev Clune, Thomas L. (GSFC-6101) via J3 <j3 at mailman.j3-fortran.org>:
> 
> Van,
>  
> I’m certainly not opposed to a more targeted swap facility.    But any generics solution ought to be powerful enough to provide similar functionality, albeit with less elegance.
>  
> I’m not immediately seeing a problem with finalization.
>  
> A generic subroutine could handle the disambiguation through additional template parameters.   This would, of course, preclude using SWAP in multiple contexts within the same scope without judicious use of rename.  But better rename than implementing and maintaining multiple template variations.   The latter would not be intolerable for SWAP, where the declarations outweigh the implementation and the whole package is small in any event.   But for more complex algorithms the usual problems with duplicated code would be a real concern.
>  
> Cheers,
>  
> 	• Tom
>  
> 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, June 21, 2021 at 8:53 PM
> To: j3 <j3 at mailman.j3-fortran.org>
> Cc: Van Snyder <van.snyder at sbcglobal.net>
> Subject: [EXTERNAL] Re: [J3] 21-144r2
>  
> On Tue, 2021-06-22 at 00:34 +0000, Shterenlikht, Anton via J3 wrote:
>> *quote*
>> ALG-1: Should the generics facility enable developers to define a
>>        scalar SWAP template that will apply to any type that supports
>>        assigment?  (YES, NO, UNDECIDED, ABSTAIN)
>> *end quote*
>  
> A swap statement has repeatedly been requested. Something like
>  
> x :=: y
>  
> for variables, and
>  
> x <=> y
>  
> for pointers.
>  
> Semantics can be debated. For example, if one is allocatable and the other not, how does that affect finalization? It's not obvious that this question even makes sense if SWAP is a generic subroutine because allocatability does not participate in generic resolution.



More information about the J3 mailing list