J3/00-167 Date: 5 May 2000 To: J3 From: R. Maine Subject: F90 interp 13 and the f2k IMPORT Paper J3/99-197R1 presented several options for dealing with the interface body scoping problem. A straw vote favored addition of an IMPORT statement. However, it occurs to me that there may be a simpler and less confusing solution than any of those presented in that paper. I suggest that we review and reconsider f90 interpretation 13. I recall this interp as one that was being debated at my very first J3 meeting (meeting 119). It was very controversial from the start. The f90 standard, as originally published, unambiguously said that host association worked with interface bodies just like it worked elsewhere. There were even examples illustrating this. Interp 13 said that this was an error and revised f90 to change it. There was a bit of controversy over whether or not to make interface bodies an exception to the host association rules. There was perhaps even more controversy over whether it was acceptable to change something that was unambiguous and consistent in the standard as published. I don't propose to revisit the issue as an f95 interp. I didn't like retroactive revision when interp 13 was being debated, and I still don't like it. I figure that interps are to correct actual errors rather than to do retroactive design. But we could still change this in f2k. It seems to me that the whole business of adding an IMPORT statement is just a workaround to a problem introduced by interp 13. I propose fixing the problem instead of working around it. We already have users regularly being confused by the fact that host association doesn't go into interface bodies. Check comp.lang.fortran and comp-fortran-90 archives for regular reoccurances of this confusion. The IMPORT statement allows you to specify that a specific list of names is imported to an interface body, just like they would have been in the first place without interp 13. Adding a whole new statement to the language to hack around a bug strikes me as questionable. Wouldn't it be much simpler to just have f2k allow host association into interface bodies just like in all other scping units? Effectively reverse interp 13 for f2k. There then would be no need to train users about how host association works differently for interface bodies. And there would be no need for an IMPORT statement to fix it up in the cases where you really need it. Note that the stated goals of interp 13 are defeated by the IMPORT statement anyway. With the IMPORT statement, you are no longer be guaranteed that the same text of an interface body will be interpreted identically independent of the host. The advantages of reversing interp 13 seem obvious to me. The language would be simpler in that there would be no special case for host association into interface bodies and there would be no need for a new statement. The disadvantages seem small in comparison. 1. There would be a small incompatability with f90/f95 for rare cases of badly-written code. If an interface body depended on default implicit typing and was in a host with non-default implicit typing, then the interface body might have a different interpretation. There's an excellent chance that this is the interpretation a user would have expected anyway. This would be appropriate to list in the introduction under incompatabilities. 2. There would be more ways to write interface bodies that had different interpretations in different hosts, and such dependency wouldn't be as immediately obvious as it is with an IMPORT statement. But I claim that this is no different from lots of other things in Fortran, that a well-written interface body won't run into this, and that it will cause less confusion than is quite clearly caused by the current state of affairs. You don't *HAVE* to have such dependence, except for the cases where you'd need an IMPORT statement and thus be so dependent anyway. Indeed, this is very much like the (true) statement that a subprogram might have a different interpretation if you move it to a different host and it depended on host association. I believe that experience has shown interp 13 to be a mistake. I propose that we fix that mistake in f2k rather than patching around it.