[J3] [EXTERNAL] Re: Is this legal in F202X? Rank agnosticism and scalars

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Wed Jan 25 14:51:56 UTC 2023


Vipul,

Good question.    Currently SELECT RANK requires an assumed rank array.    Extending this to allow other arrays looks like it would be relatively straightforward, but I’ve not yet had a chance to give it any thought.

My preference would be to allow `a(@idx)` where `a` is a scalar and `idx` is a size 0 array as that would be the most harmonious with rank-agnostic source code.  But I can understand why others would object to treating a scalar in such a fashion.




  *   Tom

From: Vipul Parekh <parekhvs at gmail.com>
Date: Tuesday, January 24, 2023 at 8:50 PM
To: "Clune, Thomas L. (GSFC-6101)" <thomas.l.clune at nasa.gov>
Cc: j3 <j3 at mailman.j3-fortran.org>
Subject: Re: [EXTERNAL] Re: [J3] Is this legal in F202X? Rank agnosticism and scalars



On Tue, Jan 24, 2023 at 11:52 AM Clune, Thomas L. (GSFC-6101) <thomas.l.clune at nasa.gov<mailto:thomas.l.clune at nasa.gov>> wrote:
..

Yes – SELECT RANK could be the best way to sidestep this concern.  Thanks! ..

Hi Tom,

That is good to know re: SELECT RANK.

When you consider all your use cases toward templates with Rank-based generics, do you think SELECT RANK semantics will cover all the scenarios of interest, like the one you mentioned in the original message here?  That is, at least as things stand with it in the current standard with no change as far as I can recall in Fortran 2023?

If I can locate my notes I will share them but my recollection was SELECT RANK holds great promise but as designed in the standard, there are limitations.  For example, my understanding is it only be referenced with *assumed-rank* entities (those defined with .. rank-spec).but what appears of interest to you from the original message is also *assumed-shape* received arguments and perhaps even deferred-shape.  So it may be worth a discussion / proposal you may want to have with /DATA on this.

Regards,
Vipul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230125/98d4f684/attachment.htm>


More information about the J3 mailing list