From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Thu Apr 10 04:15:36 2025
Return-Path: <owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom9
Delivered-To: sc22wg5-dom9@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 06A45356976; Thu, 10 Apr 2025 04:15:36 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 398 seconds by postgrey-1.34 at www5.open-std.org; Thu, 10 Apr 2025 04:15:34 CEST
Received: from nag-j.co.jp (bvdeuz19.secure.ne.jp [180.222.80.19])
	by www.open-std.org (Postfix) with SMTP id 3EC78356652
	for <sc22wg5@open-std.org>; Thu, 10 Apr 2025 04:15:33 +0200 (CEST)
Received: (qmail 69520 invoked from network); 10 Apr 2025 11:08:52 +0900
Received: from unknown (HELO Maru10) (218.42.159.105)
  by 0 with SMTP; 10 Apr 2025 11:08:52 +0900
From: "Malcolm Cohen" <malcolm@nag-j.co.jp>
To: "'sc22wg5'" <sc22wg5@open-std.org>
References: <92b8beb0b6209af89fbf0f413146dc17c87beb72.camel.ref@sbcglobal.net> <20250409230443.AF993356936@www.open-std.org>
In-Reply-To: <20250409230443.AF993356936@www.open-std.org>
Subject: =?utf-8?Q?RE:_=5Bukfortran=5D__=5BSC22WG5.6679=5D_?=
	=?utf-8?Q?I_don't_get_a_vote=2C_but_=E2=80=A6?=
Date: Thu, 10 Apr 2025 11:08:52 +0900
Message-ID: <003401dba9bd$81b138f0$8513aad0$@nag-j.co.jp>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0035_01DBAA08.F198E0F0"
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQJplxeujoKDXTME7tr1Y7UxWP2EugFwJwWasnTIkNA=
Content-Language: ja
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

This is a multipart message in MIME format.

------=_NextPart_000_0035_01DBAA08.F198E0F0
Content-Type: text/plain;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hi Van,

=20

N2217 is from 2023. There are J3 papers proposing requirements, =
specifications, and syntax. Even a draft edits paper.

=20

1.	I think it was because it called an intrinsic function that requires =
an argument to be an array. That needs the scalar case to be separate. =
There have been suggestions to loosen some of these requirements, but =
that degrades error detection, so there is a tradeoff.
2.	Yes, generic procedures cannot be used as actual arguments. This has =
always been the case. It is usually possible to do things differently, =
without deleterious effects on code size or readability. So far we have =
not found a compelling reason to invent another way to work around this. =
As you surmise, having auto-generic procedures might tip the balance on =
this. Or might not. F2028 is already overly ambitious, in my opinion, so =
realistically we=E2=80=99d be talking F203z or later for any such =
feature.

=20

Cheers,

--=20

..............Malcolm Cohen, NAG Oxford/Tokyo.

=20

From: owner-sc22wg5@open-std.org <owner-sc22wg5@open-std.org> On Behalf =
Of Van Snyder
Sent: Thursday, April 10, 2025 8:05 AM
To: sc22wg5 <sc22wg5@open-std.org>
Subject: [ukfortran] [SC22WG5.6679] I don't get a vote, but =E2=80=A6

=20

I'm J3 emeritus so I don't get an official vote, but I have a few minor =
comments on N2217:

=20

1. Why is a separate specific procedure exemplar needed for RANK(0) and =
RANK(1:15)? Could RANK(0:15) be used?

=20

2. Generic procedures cannot be used as actual arguments. If one has a =
module written under the present system that contains numerous specific =
procedures and a generic identifier that glues them together, specific =
procedures have identifiers.  If their identifiers are accessible, they =
can be used as actual arguments. In the proposal in N2217, the specific =
procedures do not have accessible identifier. A solution I mentioned in =
04-391r1 is to provide a mechanism to compute the specific procedure =
from a generic identifier, at compile time, so it can be used as an =
actual argument. It would be even more useful in this context than it =
would have been in the existing scheme.

=20

I amended the 04-391r1 scheme in a later "wishlist" paper that I might =
or might not have submitted to the J3 archive:

=20

Rationale

With care and diligence, one can develop a program so that related sets =
of variables, constants

and function results are parameterized by a single kind type parameter. =
In order to change the

kind of that set of entities, one need only change one named =
constant=E2=80=99s definition =E2=80=94 almost:

Generic procedures cannot be actual arguments or procedure pointer =
targets. Thus, if one

needs to change the program, in addition to changing the single named =
constant definition, one

needs to find all places where a specific procedure that operates on the =
entities in question is

an actual argument or procedure pointer target, and manually edit those =
appearances.

Alternatively, one needs to write a specific procedure, with arguments =
appropriately parame-

terized, which in turn references the generic procedure, and pass that =
specific procedure as an

actual argument. This is less onerous than before Fortran 2008, because =
of the ability to pass

internal procedures as actual arguments. Nonetheless, it increases code =
bulk, which increases

lifetime cost.

=20

It would be helpful to have a facility to resolve a generic name to a =
specific procedure without

evaluating any arguments or invoking a procedure.

=20

Proposal

Allow an actual procedure argument to be a generic identifier provided =
the referenced procedure

has explicit interface, and the dummy argument corresponding to the =
procedure actual argument

has explicit interface. Generic resolution of the actual argument to a =
specific procedure would

be based upon characteristics of its associated dummy argument.

=20

Allow a procedure pointer target to be a generic identifier provided the =
procedure pointer has

explicit interface. Generic resolution of the pointer target to a =
specific procedure would be

based upon characteristics of the procedure pointer.Proposal

=20

Alternative proposal

If an actual argument is generic-name, and an interface body with that =
name is accessible at

the point the procedure is invoked, the procedure that is invoked shall =
have explicit interface.

The dummy argument associated with a generic-name shall be a dummy =
procedure with ex-

plicit interface. The specific procedure from the interface that is =
compatible with the dummy

argument is associated with the dummy argument. If the dummy argument is =
a subroutine

the generic-name shall identify an interface that provides a subroutine =
that is compatible with

the dummy argument=E2=80=99s interface, and that subroutine is =
associated with the dummy argument.

If the dummy argument is a function the generic-name shall identify an =
interface that pro-

vides a function that is compatible with the dummy argument=E2=80=99s =
interface, and that function is

associated with the dummy argument.

=20

If a proc-target in a procedure pointer assignment statement is =
generic-name, and an interface

body with that name is accessible at the point where procedure pointer =
assignment appears,

the proc-pointer shall have explicit interface, the generic-name shall =
identify an interface that

provides a specific procedure that is compatible with the pointer =
object=E2=80=99s interface, and the

proc-pointer becomes associated with that specific subroutine or =
function.


------=_NextPart_000_0035_01DBAA08.F198E0F0
Content-Type: text/html;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta =
name=3DGenerator content=3D"Microsoft Word 15 (filtered =
medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:=E6=B8=B8=E3=82=B4=E3=82=B7=E3=83=83=E3=82=AF;
	panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Aptos;}
@font-face
	{font-family:"\@=E6=B8=B8=E3=82=B4=E3=82=B7=E3=83=83=E3=82=AF";
	panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:36.0pt;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;}
span.18
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	mso-ligatures:none;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:99.25pt 3.0cm 3.0cm 3.0cm;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:721833911;
	mso-list-type:hybrid;
	mso-list-template-ids:-999258034 134807567 134807577 134807579 =
134807567 134807577 134807579 134807567 134807577 134807579;}
@list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-GB =
link=3D"#0563C1" vlink=3D"#954F72" style=3D'word-wrap:break-word'><div =
class=3DWordSection1><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>Hi =
Van,<o:p></o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p>&nbsp;</=
o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>N2217 is =
from 2023. There are J3 papers proposing requirements, specifications, =
and syntax. Even a draft edits paper.<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p>&nbsp;</=
o:p></span></p><ol style=3D'margin-top:0cm' start=3D1 type=3D1><li =
class=3DMsoListParagraph style=3D'margin-left:0cm;mso-list:l0 level1 =
lfo1'><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>I think it =
was because it called an intrinsic function that requires an argument to =
be an array. That needs the scalar case to be separate. There have been =
suggestions to loosen some of these requirements, but that degrades =
error detection, so there is a tradeoff.<o:p></o:p></span></li><li =
class=3DMsoListParagraph style=3D'margin-left:0cm;mso-list:l0 level1 =
lfo1'><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>Yes, generic =
procedures cannot be used as actual arguments. This has always been the =
case. It is usually possible to do things differently, without =
deleterious effects on code size or readability. So far we have not =
found a compelling reason to invent another way to work around this. As =
you surmise, having auto-generic procedures might tip the balance on =
this. Or might not. F2028 is already overly ambitious, in my opinion, so =
realistically we=E2=80=99d be talking F203z or later for any such =
feature.<o:p></o:p></span></li></ol><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p>&nbsp;</=
o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>Cheers,<o:p><=
/o:p></span></p><div><p class=3DMsoNormal =
style=3D'text-align:justify;text-justify:inter-ideograph'><span =
lang=3DEN-US =
style=3D'font-size:10.5pt;font-family:"Calibri",sans-serif'>-- =
</span><span =
style=3D'font-size:10.5pt;font-family:"Calibri",sans-serif'><o:p></o:p></=
span></p><p class=3DMsoNormal =
style=3D'text-align:justify;text-justify:inter-ideograph'><span =
lang=3DEN-US =
style=3D'font-size:10.5pt;font-family:"Calibri",sans-serif'>.............=
.Malcolm Cohen, NAG Oxford/Tokyo.</span><span =
style=3D'font-size:10.5pt;font-family:"Calibri",sans-serif'><o:p></o:p></=
span></p></div><p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p>&nbsp;</=
o:p></span></p><div><div style=3D'border:none;border-top:solid #E1E1E1 =
1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=3DMsoNormal><b><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span><=
/b><span style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif'> =
owner-sc22wg5@open-std.org &lt;owner-sc22wg5@open-std.org&gt; <b>On =
Behalf Of </b>Van Snyder<br><b>Sent:</b> Thursday, April 10, 2025 8:05 =
AM<br><b>To:</b> sc22wg5 &lt;sc22wg5@open-std.org&gt;<br><b>Subject:</b> =
[ukfortran] [SC22WG5.6679] I don't get a vote, but =
=E2=80=A6<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><div><p class=3DMsoNormal>I'm J3 =
emeritus so I don't get an official vote, but I have a few minor =
comments on N2217:<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>1. Why is a separate specific procedure exemplar =
needed for RANK(0) and RANK(1:15)? Could RANK(0:15) be =
used?<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>2. Generic procedures cannot be used as actual =
arguments. If one has a module written under the present system that =
contains numerous specific procedures and a generic identifier that =
glues them together, specific procedures have identifiers. &nbsp;If =
their identifiers are accessible, they can be used as actual arguments. =
In the proposal in N2217, the specific procedures do not have accessible =
identifier. A solution I mentioned in 04-391r1 is to provide a mechanism =
to compute the specific procedure from a generic identifier, at compile =
time, so it can be used as an actual argument. It would be even more =
useful in this context than it would have been in the existing =
scheme.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=3DMsoNormal>I =
amended the 04-391r1 scheme in a later &quot;wishlist&quot; paper that I =
might or might not have submitted to the J3 =
archive:<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal><b>Rationale</b><o:p></o:p></p></div><div><p =
class=3DMsoNormal>With care and diligence, one can develop a program so =
that related sets of variables, constants<o:p></o:p></p></div><div><p =
class=3DMsoNormal>and function results are parameterized by a single =
kind type parameter. In order to change the<o:p></o:p></p></div><div><p =
class=3DMsoNormal>kind of that set of entities, one need only change one =
named constant=E2=80=99s definition =E2=80=94 =
almost:<o:p></o:p></p></div><div><p class=3DMsoNormal>Generic procedures =
cannot be actual arguments or procedure pointer targets. Thus, if =
one<o:p></o:p></p></div><div><p class=3DMsoNormal>needs to change the =
program, in addition to changing the single named constant definition, =
one<o:p></o:p></p></div><div><p class=3DMsoNormal>needs to find all =
places where a specific procedure that operates on the entities in =
question is<o:p></o:p></p></div><div><p class=3DMsoNormal>an actual =
argument or procedure pointer target, and manually edit those =
appearances.<o:p></o:p></p></div><div><p =
class=3DMsoNormal>Alternatively, one needs to write a specific =
procedure, with arguments appropriately =
parame-<o:p></o:p></p></div><div><p class=3DMsoNormal>terized, which in =
turn references the generic procedure, and pass that specific procedure =
as an<o:p></o:p></p></div><div><p class=3DMsoNormal>actual argument. =
This is less onerous than before Fortran 2008, because of the ability to =
pass<o:p></o:p></p></div><div><p class=3DMsoNormal>internal procedures =
as actual arguments. Nonetheless, it increases code bulk, which =
increases<o:p></o:p></p></div><div><p class=3DMsoNormal>lifetime =
cost.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>It would be helpful to have a facility to resolve a =
generic name to a specific procedure without<o:p></o:p></p></div><div><p =
class=3DMsoNormal>evaluating any arguments or invoking a =
procedure.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal><b>Proposal</b><o:p></o:p></p></div><div><p =
class=3DMsoNormal>Allow an actual procedure argument to be a generic =
identifier provided the referenced procedure<o:p></o:p></p></div><div><p =
class=3DMsoNormal>has explicit interface, and the dummy argument =
corresponding to the procedure actual =
argument<o:p></o:p></p></div><div><p class=3DMsoNormal>has explicit =
interface. Generic resolution of the actual argument to a specific =
procedure would<o:p></o:p></p></div><div><p class=3DMsoNormal>be based =
upon characteristics of its associated dummy =
argument.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>Allow a procedure pointer target to be a generic =
identifier provided the procedure pointer =
has<o:p></o:p></p></div><div><p class=3DMsoNormal>explicit interface. =
Generic resolution of the pointer target to a specific procedure would =
be<o:p></o:p></p></div><div><p class=3DMsoNormal>based upon =
characteristics of the procedure =
pointer.Proposal<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal><b>Alternative =
proposal</b><o:p></o:p></p></div><div><p class=3DMsoNormal>If an actual =
argument is generic-name, and an interface body with that name is =
accessible at<o:p></o:p></p></div><div><p class=3DMsoNormal>the point =
the procedure is invoked, the procedure that is invoked shall have =
explicit interface.<o:p></o:p></p></div><div><p class=3DMsoNormal>The =
dummy argument associated with a generic-name shall be a dummy procedure =
with ex-<o:p></o:p></p></div><div><p class=3DMsoNormal>plicit interface. =
The specific procedure from the interface that is compatible with the =
dummy<o:p></o:p></p></div><div><p class=3DMsoNormal>argument is =
associated with the dummy argument. If the dummy argument is a =
subroutine<o:p></o:p></p></div><div><p class=3DMsoNormal>the =
generic-name shall identify an interface that provides a subroutine that =
is compatible with<o:p></o:p></p></div><div><p class=3DMsoNormal>the =
dummy argument=E2=80=99s interface, and that subroutine is associated =
with the dummy argument.<o:p></o:p></p></div><div><p =
class=3DMsoNormal>If the dummy argument is a function the generic-name =
shall identify an interface that pro-<o:p></o:p></p></div><div><p =
class=3DMsoNormal>vides a function that is compatible with the dummy =
argument=E2=80=99s interface, and that function =
is<o:p></o:p></p></div><div><p class=3DMsoNormal>associated with the =
dummy argument.<o:p></o:p></p></div><div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p></div><div><p =
class=3DMsoNormal>If a proc-target in a procedure pointer assignment =
statement is generic-name, and an interface<o:p></o:p></p></div><div><p =
class=3DMsoNormal>body with that name is accessible at the point where =
procedure pointer assignment appears,<o:p></o:p></p></div><div><p =
class=3DMsoNormal>the proc-pointer shall have explicit interface, the =
generic-name shall identify an interface =
that<o:p></o:p></p></div><div><p class=3DMsoNormal>provides a specific =
procedure that is compatible with the pointer object=E2=80=99s =
interface, and the<o:p></o:p></p></div><div><p =
class=3DMsoNormal>proc-pointer becomes associated with that specific =
subroutine or function.<o:p></o:p></p></div></div></body></html>
------=_NextPart_000_0035_01DBAA08.F198E0F0--

