On 10 Jul 2003 at 22:27, Frank Heckenbach wrote:
J. David Bryan wrote:
I don't know whether these are bugs or intentionally revised features.
The latter.
Noted, thanks.
EP is clear on that an interface module requires an implementation.
Yes, but must that implementation be an EP module? EP 6.13 section 2d suggests not, saying that interfacing to other languages might be provided by:
"The association of a module-heading with a construct in another language that the implementation has determined to be equivalent to a module-block."
That would seem to indicate that an interface-only EP module is legal if an appropriate implementation is provided elsewhere. That would provide for compiling and linking an EP program, an EP interface-only module, and a non- EP routine that provides the module-block (implementation). The introduction in the EP manual appears to support this concept:
"Modules provide a framework for implementation of libraries and non-Pascal program components."
Solution: Use a non-interface module (drop `interface' and add `end;' before `end.').
But changing to:
module ifmod;
export ifmod = (proc);
procedure proc;
end;
end.
...gives me:
ifmod.pas:7: unresolved forward declaration `proc'
GPC is looking for an implementation of "proc" in the module-block, which makes sense. So that means that I need to declare "proc" external as well.
I have re-read the thread "Modules without implementation" at:
http://www.gnu-pascal.de/crystal/gpc/en/thread8400.html
Gale Paeper suggests adopting the "implementation advice" in EP 6.1.5, i.e.:
"A processor may provide, as an extension, the interface-directive external, which is used to specify that the module-block corresponding to the module-heading containing the interface-directive is in some form other than an Extended Pascal module-block (e.g., it is implemented in some other language)."
Whereas you suggest the EP 6.1.4 mechanism:
"...I prefer to specify this on a per routine basis, because it's not generally optimal to have everything or nothing external...."
I take your point, except in the case where everything _is_ provided by an external module (e.g., interfacing to a non-Pascal library). In that case, it is tedious and error-prone to append "external" after each of perhaps dozens or hundreds of routines.
Which was a bug that caused some serious problems (e.g., strings in interface modules not being initialized).
An important consideration except in cases where the implementation is provided by an external source.
-- Dave