Gale Paeper wrote:
This should also export `a' and `b' from m2 (since `a' is principal, `c' is not):
Frank, this comment doesn't seem to match up with the following example as you have typed it. Is there a typo in "export m2 = (c .. b);"?
If you meant it to be "export m2 = (a .. b);" (note the use of "a" instead of the "c" as you have posted), then your comment makes sense and is correct ( or is at least correct as I understand the requirements in this area).
If you meant exactly what you posted "export m2 = (c .. b);", then your comment makes no sense and is not correct in several ways since "export m2 = (c .. b);" does not lead to a constituent-identifier "a" being exported through interface "m2" and the export-range usage is illegal since the imported constituent-identifier "c" from interface "m" is not a principal identifier of the denoted value.
module m; export m = (e, a, b, a => c); type e = (a, b); end; end.
module m2; export m2 = (c .. b); import m; end; end.
I really mean it. Note this part of 6.11.2 (emphasis by me):
: For each value(!) of the type of an exportÂrange not smaller than : the leastÂvalue of the exportÂrange and not larger than the : greatestÂvalue of the exportÂrange : : a) the exportÂrange shall be within the scope of a definingÂpoint : of an(!) identifier that is a principal identifier of the : value;
Here we have an export range whose least-value is the value that `c' has in m2 (which is the value whose principal identifier is `a', because `a' was exported and renamed to `c' from m; we could have gotten the same effect with `const c = a;', for example), and the greatest-value is the value of `b', of course.
So for each value in this range (which are just these two values), we need to have a principal identifier in the scope of m2. These principal identifiers are `a' and `b' since they were exported as principal identifiers from m (whereas `c' was not exported as a principal identifier).
So if I read the standard correctly, the range export indeed does not export the identifier `c', although it's explicitly named, but exports `a' and `b' as principal identifiers (export ranges always export principal identifiers, according to c). See also note 6.
As the whole text of ISO 10206 is presently written, there seems to be a logic conflict no matter which position you try to take on exporting of 6.2.2.10 required-identifiers. Perhaps I'm missing come critical point, [...]
I don't know. Perhaps we should take it to the newsgroup again, but if the standard really is unclear, I'll surely prefer the simpler (and intended, according to John Reagan) option of not allowing it.
Frank