[J3] another PURE example
parekhvs at gmail.com
Tue Oct 6 01:37:48 EDT 2020
On Mon, Oct 5, 2020 at 6:13 PM Robert Corbett via J3 <
j3 at mailman.j3-fortran.org> wrote:
> PURE SUBROUTINE SUBR
> USE T1
> USE T2, TINIT => T
> TYPE(T) Y
> 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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the J3