[J3] another PURE example
malcolm at nag-j.co.jp
Tue Oct 6 03:00:03 EDT 2020
>I am thinking derived types are local identifiers and thus 'TINIT' is a different type than 'T'.
1. Derived types are not identifiers.
2. Whether you have a rename or not, there is a local identifier for a local entity that is use-associated with the module entity.
3. The rules for whether two types are “the same type” are spelled out in clause 7, in particular, in 188.8.131.52 Determination of derived types. This is non-trivial for SEQUENCE types.
4. At first glance, Robert’s two type definitions appear to satisfy the requirements for the two type definitions to be the same.
..............Malcolm Cohen, NAG Oxford/Tokyo.
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Vipul Parekh via J3
Sent: Tuesday, October 6, 2020 2:38 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Vipul Parekh <parekhvs at gmail.com>
Subject: Re: [J3] another PURE example
On Mon, Oct 5, 2020 at 6:13 PM Robert Corbett via J3 <j3 at mailman.j3-fortran.org <mailto:j3 at mailman.j3-fortran.org> > wrote:
PURE SUBROUTINE SUBR
USE T2, TINIT => T
Y = TINIT()
Y%P = 2.0
At first glance, your assignment instruction 'Y = TINIT()' looks non-conforming to me.
I am thinking derived types are local identifiers and thus 'TINIT' is a different type than 'T'. Since there is no defined assignment, the TKR rules for intrinsic assignment aren't being followed with the 'Y = TINIT()' assignment. Now, if you implement a defined assignment, you won't be able to make it a PURE procedure and yet shallow/deep copy the POINTER component. And without a PURE defined assignment, you won't be able to do what you are doing in your 'SUBR' procedure. Thus the semantics of PURE looks Ok as captured in the standard?
Some food for thought?
The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our <https://www.nag.co.uk/content/privacy-notice> Privacy Notice for information on how we process personal data and for details of how to stop or limit communications from us.
This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3