From owner-sc22wg5+sc22wg5-dom9=www.open-std.org@open-std.org  Wed Sep 18 11:20:35 2024
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 11A37357015; Wed, 18 Sep 2024 11:20:35 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
X-Greylist: delayed 397 seconds by postgrey-1.34 at www5.open-std.org; Wed, 18 Sep 2024 11:20:33 CEST
Received: from nag-j.co.jp (bvdeuz19.secure.ne.jp [180.222.80.19])
	by www.open-std.org (Postfix) with SMTP id CFB14356F3A
	for <sc22wg5@open-std.org>; Wed, 18 Sep 2024 11:20:33 +0200 (CEST)
Received: (qmail 65736 invoked from network); 18 Sep 2024 18:13:51 +0900
Received: from unknown (HELO Maru10) (218.42.159.105)
  by 0 with SMTP; 18 Sep 2024 18:13:51 +0900
From: "Malcolm Cohen" <malcolm@nag-j.co.jp>
To: "'WG5'" <sc22wg5@open-std.org>
References:  <LV3PR12MB90956B210D8135B74A486302CB622@LV3PR12MB9095.namprd12.prod.outlook.com>
In-Reply-To:  <LV3PR12MB90956B210D8135B74A486302CB622@LV3PR12MB9095.namprd12.prod.outlook.com>
Subject: RE: [ukfortran] [SC22WG5.6604] intent(in) and value
Date: Wed, 18 Sep 2024 18:13:51 +0900
Message-ID: <002101db09ab$14305110$3c90f330$@nag-j.co.jp>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0022_01DB09F6.84190A80"
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQH/9fLaKj7MZ/xChKmAc+pwsbYi4LITZm8A
Content-Language: ja
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

This is a multipart message in MIME format.

------=_NextPart_000_0022_01DB09F6.84190A80
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi Jeff,

 

It is called "unspecified INTENT" not "default INTENT". That is because it
is not a default, it is that it is not specified. (ASIDE: I don't think we
use the phrase in the standard itself, but we do when talking about it.)

 

R828 by itself does not define the INTENT attribute, it defines some syntax
- and that is the syntax for specified intent (it's even called
"intent-spec". The whole of 8.5.10 defines the INTENT attribute, and indeed,
there is a paragraph about unspecified intent.

 

INTENT(INOUT) is very different indeed from unspecified intent. In
particular, INOUT requires that the actual argument be a definable variable.
There is no such requirement for unspecified intent. With unspecified intent
you simply have to get it right, viz not reference the dummy argument unless
it is defined, and not define the dummy argument unless it is definable.
This is the world before the invention of INTENT.

 

To summarise: with no intent-spec, the intent is not "INOUT", or "INOUT
except stuff", it is "unspecified", and has the same capabilities and
limitations that it had before Fortran 90.

 

Cheers,

-- 

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

 

From: owner-sc22wg5@open-std.org <owner-sc22wg5@open-std.org> On Behalf Of
Jeff Hammond
Sent: Wednesday, September 18, 2024 4:12 PM
To: WG5 <sc22wg5@open-std.org>
Subject: [ukfortran] [SC22WG5.6604] intent(in) and value

 

8.5.10 R828 says that INTENT is IN, OUT or INOUT.

 

8.5.19 C868 says that VALUE cannot be INTENT(OUT) or INTENT(INOUT)

 

Should I understand that dummy arguments without an INTENT do not have an
implicit intent corresponding to any of the explicit INTENT types?  I have
always assumed that the default INTENT was INOUT, but that cannot be true
since that would conflict with VALUE in the example below.  It seems the
default INTENT is "INOUT, unless VALUE, in which case it's
IN-but-also-assignable".

 

subroutine foo(a,b)

    implicit none

    integer, value, intent(in) :: a

    integer, value :: b

    ! integer, value, intent(inout) :: c ! not allowed

    ! integer, value, intent(out) :: d ! not allowed

    ! a = 21 ! can't assign because intent(in)

    b = 23 ! can assign

end subroutine foo

 

Thanks

 

Jeff


------=_NextPart_000_0022_01DB09F6.84190A80
Content-Type: text/html;
	charset="us-ascii"
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=3Dus-ascii"><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:"Yu Gothic";
	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:"Yu Gothic";
	panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
	{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	font-size:12.0pt;
	font-family:"Aptos",sans-serif;
	mso-ligatures:standardcontextual;}
span.19
	{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:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></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"#467886" vlink=3D"#96607D" 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 =
Jeff,<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'>It is called =
&#8220;unspecified INTENT&#8221; not &#8220;default INTENT&#8221;. That =
is because it is not a default, it is that it is not specified. (ASIDE: =
I don&#8217;t think we use the phrase in the standard itself, but we do =
when talking about it.)<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'>R828 by =
itself does not define the INTENT attribute, it defines some syntax =
&#8211; and that is the syntax for specified intent (it&#8217;s even =
called &#8220;intent-spec&#8221;. The whole of 8.5.10 defines the INTENT =
attribute, and indeed, there is a paragraph about unspecified =
intent.<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'>INTENT(INOUT)=
 is very different indeed from unspecified intent. In particular, INOUT =
requires that the actual argument be a definable variable. There is no =
such requirement for unspecified intent. With unspecified intent you =
simply have to get it right, viz not reference the dummy argument unless =
it is defined, and not define the dummy argument unless it is definable. =
This is the world before the invention of =
INTENT.<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'>To =
summarise: with no intent-spec, the intent is not &#8220;INOUT&#8221;, =
or &#8220;INOUT except stuff&#8221;, it is &#8220;unspecified&#8221;, =
and has the same capabilities and limitations that it had before Fortran =
90.<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'>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;mso-ligatures:=
none'>-- </span><span =
style=3D'font-size:10.5pt;font-family:"Calibri",sans-serif;mso-ligatures:=
none'><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;mso-ligatures:=
none'>..............Malcolm Cohen, NAG Oxford/Tokyo.</span><span =
style=3D'font-size:10.5pt;font-family:"Calibri",sans-serif;mso-ligatures:=
none'><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;mso-ligatures:=
none'>From:</span></b><span =
style=3D'font-size:11.0pt;font-family:"Calibri",sans-serif;mso-ligatures:=
none'> owner-sc22wg5@open-std.org &lt;owner-sc22wg5@open-std.org&gt; =
<b>On Behalf Of </b>Jeff Hammond<br><b>Sent:</b> Wednesday, September =
18, 2024 4:12 PM<br><b>To:</b> WG5 =
&lt;sc22wg5@open-std.org&gt;<br><b>Subject:</b> [ukfortran] =
[SC22WG5.6604] intent(in) and value<o:p></o:p></span></p></div></div><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
lang=3DEN-US>8.5.10 R828 says that INTENT is IN, OUT or =
INOUT.<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>8.5.19 C868 says that VALUE cannot be INTENT(OUT) or =
INTENT(INOUT)<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Should I understand that dummy arguments without an INTENT =
do not have an implicit intent corresponding to any of the explicit =
INTENT types?&nbsp; I have always assumed that the default INTENT was =
INOUT, but that cannot be true since that would conflict with VALUE in =
the example below.&nbsp; It seems the default INTENT is &#8220;INOUT, =
unless VALUE, in which case it&#8217;s =
IN-but-also-assignable&#8221;.<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>subroutine =
foo(a,b)<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;&nbsp;&nbsp; implicit none<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>&nbsp;&nbsp;&nbsp; integer, value, =
intent(in) :: a<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;&nbsp;&nbsp; integer, value :: =
b<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;&nbsp;&nbsp; ! integer, value, intent(inout) :: c ! =
not allowed<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;&nbsp; &nbsp;! integer, value, intent(out) :: d ! not =
allowed<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;&nbsp;&nbsp; ! a =3D 21 ! can't assign because =
intent(in)<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>&nbsp;&nbsp;&nbsp; b =3D 23 ! can =
assign<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US>end =
subroutine foo<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Thanks<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Jeff<o:p></o:p></span></p></div></body></html>
------=_NextPart_000_0022_01DB09F6.84190A80--

