Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

semantics of procedure-declaration-stmt

80 views
Skip to first unread message

Peter Klausler US

unread,
Dec 8, 2022, 2:10:32 PM12/8/22
to
If T is some type, what are the semantic differences between

> procedure(T) :: entity

and

> type(T), external :: entity

, if any?

jfh

unread,
Dec 8, 2022, 4:25:10 PM12/8/22
to
The f2018 standard does not allow procedure(T):: entity, but does allow procedure:: entity according to

R1056 procedure-stmt is [ MODULE ] PROCEDURE [ :: ] specific-procedure-list

and

C1504 (R1502) A procedure-stmt is allowed only in an interface block that has a generic-spec.

Peter Klausler US

unread,
Dec 8, 2022, 4:44:14 PM12/8/22
to
On Thursday, December 8, 2022 at 1:25:10 PM UTC-8, jfh wrote:
> The f2018 standard does not allow procedure(T):: entity, but does allow procedure:: entity according to
>
> R1056 procedure-stmt is [ MODULE ] PROCEDURE [ :: ] specific-procedure-list
>
> and
>
> C1504 (R1502) A procedure-stmt is allowed only in an interface block that has a generic-spec.

R1502 is indeed the procedure-stmt. I'm asking about R1512, the procedure-declaration-stmt.

jfh

unread,
Dec 8, 2022, 9:49:00 PM12/8/22
to
You're also asking about
type(T), external :: entity
Where is that in the f2018 standard? Sorry I have to ask but there are a great many references to both type and external, and the ones I found didn't mention that syntax.

Steve Lionel

unread,
Dec 9, 2022, 6:22:08 AM12/9/22
to
These are similar - both declare "entity" to be a function with implicit
interface and a function result of type(T). The difference is that the
latter gives entity the EXTERNAL attribute, while the former does not.
See F2018 15.4.3.6p3.
--
Steve Lionel
ISO/IEC JTC1/SC22/WG5 (Fortran) Convenor
Retired Intel Fortran developer/support
Email: firstname at firstnamelastname dot com
Twitter: @DoctorFortran
LinkedIn: https://www.linkedin.com/in/stevelionel
Blog: https://stevelionel.com/drfortran
WG5: https://wg5-fortran.org

FortranFan

unread,
Dec 9, 2022, 9:24:59 AM12/9/22
to
On Friday, December 9, 2022 at 6:22:08 AM UTC-5, Steve Lionel wrote:

> On 12/8/2022 2:10 PM, Peter Klausler US wrote:
> > If T is some type, what are the semantic differences between
> >
> >> procedure(T) :: entity
> >
> > and
> >
> >> type(T), external :: entity
> >
> > , if any?
> These are similar - both declare "entity" to be a function with implicit
> interface and a function result of type(T). The difference is that the
> latter gives entity the EXTERNAL attribute, while the former does not.
> See F2018 15.4.3.6p3.

@Steve Lionel:

Re: your comment, "The difference is that the latter gives entity the EXTERNAL attribute, while the former does not. See F2018 15.4.3.6p3."

- it is likely inaccurate what you wrote re: the EXTERNAL attribute with "while the former does not."

Note 15.4.3.6 p1, page 298 has, "A procedure declaration statement declares procedure pointers, dummy procedures, and external procedures. It specifies the EXTERNAL attribute (8.5.9) for all entities in the proc-decl-list."

Also, the section you quoted i.e., 15.4.3.6p3 only addresses the `declaration-type-spec` aspect, it does not mention the EXTERNAL attribute because it does not need to, "If proc-interface appears and consists of declaration-type-spec, it specifies that the declared procedure entities are functions having implicit interfaces and the specified result type. If a type is specified for an external function, its function definition (15.6.2.2) shall specify the same result type and type parameters."

Steve Lionel

unread,
Dec 9, 2022, 11:01:41 AM12/9/22
to
On 12/9/2022 9:24 AM, FortranFan wrote:
> Re: your comment, "The difference is that the latter gives entity the EXTERNAL attribute, while the former does not. See F2018 15.4.3.6p3."
>
> - it is likely inaccurate what you wrote re: the EXTERNAL attribute with "while the former does not."
>
> Note 15.4.3.6 p1, page 298 has, "A procedure declaration statement declares procedure pointers, dummy procedures, and external procedures. It specifies the EXTERNAL attribute (8.5.9) for all entities in the proc-decl-list."

You are correct - I missed that.
0 new messages