(j3.2006) Problem with default expressions for kind type parameters?
Van Snyder
Van.Snyder
Fri Sep 21 22:38:19 EDT 2012
On Fri, 2012-09-21 at 22:17 -0400, Rafik Zurob wrote:
> Van Snyder wrote on 21/09/2012 10:01:19 PM:
> > In 04-162, I advocated allowing parameters, i.e., named "constant"
> > declarations, inside type definitions. For the above, instead of "note
> > to self," one would have
> >
> > type :: dt ( k )
> > integer, kind :: k = kind(0.0e0)
> > integer, parameter :: dk = selected_real_kind(digits(0.0_k)+1)
> > real(k) :: s
> > real(dk) :: d
> > end type
>
> That would work too, and is better than relying on a comment. If the
> initialization of these constants depended on kind type parameters, that
> initialization would also have to be delayed to variable declaration time.
> So in essence, they'd be very similar to kind type parameters.
In 04-200, I advocated for specification variables, which could be
declared, for example, if the name has both the "parameter" and
"dynamic" attributes (or choose a different syntax), and a value given
by a specification expression. Within a subprogram, it would get a new
value on every invocation, a frequently requested feature. Such a beast
within a type definition would behave like a length parameter, at least
if any of the entities within its defining expression are length
parameters, or variables accessed by host association.
> Regards
>
> Rafik
>
More information about the J3
mailing list