[J3] dumb question about module use not inheriting into interfaces

Vipul Parekh parekhvs at gmail.com
Fri Aug 26 19:37:31 UTC 2022


On Fri, Aug 26, 2022 at 3:07 PM Van Snyder via J3 <j3 at mailman.j3-fortran.org>
wrote:

> ..
>
> I argued that host association ought to work into interface bodies.
>
> There was an inscrutable argument that blocking host association was
> necessary so that one could put what used to be external procedures (or
> maybe only their specification parts) into interface bodies, and expect
> them to work the same way as they had as external procedures. I was unable
> to convince X3J3 that this was nonsense.
>
> Loren Meissner has my X3J3 correspondence from that era at the Computer
> History Museum. I should have scanned it all before I sent it.
>
> When we added IMPORT, I argued that J3 ought simply to turn on host
> association into interface bodies. I don't understand the argument against
> it.
>
>
Maybe J3 can now rise above the continuing nonsense by considering a new
class of "bind(C)" interfaces where there is no Fortran processor based
*external procedure* i.e., the interface corresponds to an external
procedure by means other than a Fortran processor such as a companion C
processor.  So the concept of "expect them to work the same way as they had
as external procedure" should not apply.

 And with the work started with JoR on *preprocessing* in 202Y, somehow J3
can now come to see a way to directly import the function prototype defined
by the companion processor into Fortran.  Say

module confused

..

    interface, bind(C)  !<-- *

#include "foo.h"

    end interface

..

end module


Or

module confused

..

    interface, bind(C)  !<-- *

       void foo(float *);

    end interface

..

end module


Because, given the stipulations in the Fortran standard toward a companion
processor, the very notion of a program author having to duplicate a
function prototype by manually translating it into Fortran is the ultimate
nonsense.  The Fortran processor can work with the companion processor to
arrive at all the Fortran INTERFACE information among themselves.

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


More information about the J3 mailing list