James Giles wrote:
> [log in to unmask] wrote:
> ...
> > Dan Nagle also proposed an "Assumed-kind" procedure, which is similar
> > to what James proposes, but with "*" instead of "^k1" for the kinds.
> >
> > What James and Dan are proposing is a bit simpler in the special case of
> > kind, but (at least as far as I can tell) doesn't handle the more general
> > cases that Aleks and I want to handle.
>
> Well, I don't speak for Dan's proposal, but the proposal I'm still
> formulating is completely general. Conceptually, the ideal of inference
> is the only really new concept. I will be able to implement procedures
> that are generic with respect to type.
The only proposal I've seen is the one that's generic (or parametric) w.r.t.
values. When I see one that's generic w.r.t. values, types, procedures
and packages, including both parameterized packages and instances of them,
I will study it carefully.
> > Aleks and I both propose that package parameters not be limited to
> > integers. We propose that package parameters can be and kind of value,
> > types, procedures, and packages. The procedures can be either specific
> > or generic, and the packages can be instances or "templates."
>
> The problem with both your approaches is that they are syntactically
> cumbersome and yet are still limited to template style implementations.
> If you notice on the inferred KIND example, only the semantics of the
> program is determined by the form of code. An implementation is
> free to actually implement the generic operations any way it chooses,
> not merely by preprocessing multiple instances.
This essentially asks the processor to keep a database of instances,
instead of requiring the user to do so. Generics as we have them now
in Fortran 95 were originally proposed in such a way as to require the
processor to keep a database; it nearly killed the idea. The epithet
back then was "combinatorial explosion." There are cases where it's
necessary to distinguish whether the user wants separate instances --
for example, if a parameterized package has a SAVE variable whose type
and kind do not depend on package parameters, does each instance have
one, or is it shared between instances?
Keep in mind that kind type parameters for derived types aren't limited
to being used for kind type parameters of components. They could be used
for dimensions as well. Dan has shown that they could be useful even if
they're not used for anything at all -- to simulate a physical units
facility. As such, their values aren't restricted to the kind type
parameters allowed for intrinsic types.
--
Van Snyder | What fraction of Americans believe
[log in to unmask] | Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Sean O'Keefe, George Bush, the Pope, or anybody else.
|