[J3] type definitions

Vipul Parekh parekhvs at gmail.com
Sat Aug 13 22:37:28 UTC 2022


On Sat, Aug 13, 2022 at 4:46 PM Van Snyder via J3 <j3 at mailman.j3-fortran.org>
wrote:

> ..
> I don't think the reference to KIND(X) in the second example is a
> reference to the to-be-defined component. There is no syntax to reference a
> component of a type from within the type, or indeed anywhere else. Only the
> components of objects of the type can be accessed, and then they need the
> <designator>% before the component name. ..
>

On that notion, consider the following program where the complexity of a
type parameter comes into play as opposed to a type component:

   double precision :: x  !<-- with or without this line
   type :: t(x)
      integer, kind :: x = 1
      real(kind=kind(x)) :: r
   end type
   type(t) :: a
   print *, "kind(a%r) = ", kind(a%r)
end

I think it conforms but the practitioner may possibly be surprised by the
results!

Vipul Parekh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220813/4c299e62/attachment.htm>


More information about the J3 mailing list