[J3] another PURE example

Vipul Parekh parekhvs at gmail.com
Tue Oct 6 12:23:58 EDT 2020


On Tue, Oct 6, 2020 at 3:00 AM Malcolm Cohen <malcolm at nag-j.co.jp> wrote:

>
>
> >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 *7.5.2.4 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.
>
>
Hi Malcolm,

Thanks for pointing out section 7.5.2.4 Determination of derived types.
That helps.

A couple of simple clarification questions wrt Bob's example, if you don't
mind:

1) Given the standard states, "Data entities also have the same type if
they are declared with reference to different derived-type definitions
..and have components that agree in order, name, and attributes, " firstly,
would you agree POINTER is an attribute?  And which would mean (obviously!)
that type 't' in the 2 modules below refer to different types?

module a
   type :: t
      sequence
      integer :: n
     end type
end module a

and

module b
   type :: t
      sequence
      integer, pointer :: n
     end type
end module b

2) But that your point is that because component initialization is not
mentioned in section 7.5.2.4, the presence or absence of it is not relevant
to the determination of different types?  Can you confirm?  That is, in the
example below, you think the 2 types are the same?

module a
   type :: t
      sequence
      integer, pointer :: n
     end type
end module a

and

module b
   type :: t
      sequence
      integer, pointer :: n => foo ! please assume 'foo' is a valid target
here
     end type
end module b

Thanks,
Vipul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20201006/95f570c6/attachment.htm>


More information about the J3 mailing list