Meissner examples - the last one to fall
Richard E Maine
Richard.Maine@nasa.gov
Tue Oct 4 19:40:00 GMT 2005
On Oct 4, 2005, at 6:49 AM, Paul THOMAS wrote:
>> Error: 'rect_inductor' is a PRIVATE type and cannot be a dummy
>> argument of 'mutual_ind_quad_cir_coil', which is PUBLIC at (1)
>> In file induct.f90:1824
>
> Yes, I seem not to have understood what comprises a PRIVATE type in
> this context, or I have screwed up the implementation.
I didn't go look at induct.f90 to check the context, but the definition
of a PRIVATE type in that context is *very* subtle. I recall the
longish J3 discussions about the related interps. The short version
(omitting all the supporting rationale, which goes on for a bit) is
that a type is only private if it has the private attribute in the
module where it is originally defined. If you import (va USE) a type
into some other module and declare it private there, that doesn't
actually make the type private - that just means that the second module
doesn't "export" it. The language keyword PRIVATE is unfortunately
misleading in that it doesn't mean private. In the words of the
standard (or close to them - I didn't go find and copy the exact ones,
but I recall them pretty well from the long debate), the private
attribute means that the entity "is not a public entity of this
module". Note the peculiar negative form. Why does it talk about not
being public instead of about being private? That's because it might
still be public from some other module. Indeed, it must have been if
you managed to get it via USE in the first place. Only if it is
declared private in the original module is it really private.
P.S. Most of this nitpicking is made irrelevant in f2003. In fact, I
had to go check to make sure it was f2003 instead of f95. Alas, it
isn't until f2003, so one still has to deal with it in f95. The whole
constraint in question is "silly". It achieves nothing useful,
invalidates perfectly sensible code (even after you interpret it
correctly), and is based on a fundamental misconception of what
accessibility is about. F2003 removes the silly restriction (and a few
related ones).
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
More information about the Fortran
mailing list