Werner Schulz wrote:
[ Examples of getting meaningful derived type definitions into interface
bodies for dummy procedures deleted.]
> (It would be nicer to combine both modules into one but that will have to
> wait until F2000 comes with OOP and procedure interfaces. This version
> is an attempt at writing an object-based version with all the shortcomings
> inherent in it, but at least it is quite clear and safe and modular.)
Unfortunately, F2000 will do nothing for this problem. An interface
body will still be used to define an abstract interface, and host
association will still not be available inside of interface bodies.
As a consequence, it will still be impossible directly to construct a
procedure that needs access to private components of a derived type, and
that has a dummy procedure that has an argument of that derived type.
A two-layer approach of the kind described by Ohl and Schulz is possible,
but this decreases efficiency, and increases life cycle cost.
If any of the fundamental operations of the type need access to a
procedure that has a dummy procedure that has an argument of the type, the
two-layer approach leads to circular inclusion, but code duplication, or
more complex more-than-two layer approaches may be possible -- they would,
however, have even stronger effects on efficiency and life cycle costs.
There was controversy in 1986-1990 about the decision to prohibit host
association into interface bodies. My opinion, then and now, is that it
was a blunder. I commented several times during that period about this
problem. Apparently, other factors that I have yet to fathom were more
important in leading to the ultimate decision. No contemporary
explanations are compelling; perhaps it's because they are substantially
blurred by the passage of ten years.
There have been several discussions in this forum about this issue, and
occasional agreement that Something Ought to be Done. There have even
been occasional half-baked proposals about What Ought to be Done. Given
the procedural rules of WG5 and J3, however, it is obvious that Nothing
will be Done before 2007, and probably nothing will be done then.
My preference is that the decision to prohibit host association into
interface bodies should be reversed. This would be a small change in
the standard, and would probably simplify compilers. It would be an
incompatible change, but it could affect only (very few)**3 program units.
("Very few" is cubed because first they would need not to use "implicit
none," second they would need to have interface bodies, and third they
would need to have employed the slipshod programming practices that cause
a difference in interpretation depending on whether host association is
available inside of interface bodies.)
Best regards,
Van Snyder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|