Gale Paeper wrote:
<snipped general explanations>
I think you missed an important point: interfaces _have to_ brak normal textual scope rules. 6.2.2.2 states that inteface is a separate region outside of the program text -- in particular inteface is a different region then an export list.
Note that 6.11.2 tells us that exportable-name give as defining point in the interface. General rules (especially 6.2.2.7) tell us that the occurence of exportable-name is simultaneously an applied occurence of identifier in export list, which is defined later.
Frank Heckenbach wrote:
A question to the EP experts. Are these things allowed?
a) module m; export m = (a => a); const a = 1; end; end.
Illegal. The first "a" is a constant-identifier applied occurrence whose defining point location is in a region outside the "m" interface region. The second "a" is a constituent-identifier defining occurrence which by point 4 above makes the first "a" an illegal construct.
The same analysis would indicate that
module n; export n = (a); const a = 1; end; end.
is illegal. However my reading is that modules `m' and `n' are equivalent. Namely, in both cases we have applied occurence of `a' in the export-list, reffering to the definition of constant `a' and a defining point of `a' in the interface -- since interface and export-list are different regions both can coexist.
c) module m; export m = (a => b, a); const a = 1; end; end.
Illegal. The first "a" is a constant-identifier applied occurrence whose defining point location is in a region outside the "m" interface region. The second "a" is a constituent-identifier defining occurrance which by point 4 above makes the first "a" an illegal construct.
Again legal, defining occurences are in the in the interface, applied occurrences are in the export list.
<snipped analysis of imports> I agree.
P.S. Frank, quite some time ago in the comp.lang.pascal.ansi-iso newsgroup you asked a question about exporting with possibly renaming predefined/required identifiers and I don't think you every got an ISO 10206 based answer. The 6.2.2.9 b) define-before-use rule exception I mentioned in export interface regions point 3 which requires exportable-names to have module-heading region defining-points in conjunction with 6.2.2.10 which conceptually places all but four of the required identifiers in a region enclosing the program is what precludes exporting with possibly renaming all but two of the required identifiers.
I think that 6.2.2.9 b) do not forbid anything -- it allows normal case (exporting identifiers declared in module-heading), but just normal rules allows exporting predefined identifiers -- they are already defined when export list is seen, so there is no need to apply 6.2.2.9 b).