Bugzilla – Bug 678
path problems with compiled files and the include directive
Last modified: 2014-04-16 01:01:10 CEST
Suppose we have the following files:
works as expected.
?- lib(fcompile), fcompile("q").
throws an exception:
File does not exist : in ensure_loaded("p")
*** compilation aborted in the file .../q.eco
Hmm, it's more tricky than I thought... Certainly there should be no
inconsistency between compiling the .pl and loading the .eco!
However, in ECLiPSe 6.0, include/1 is supposed to have true include-semantics
(while in 5.X it was merely an alias for compile/1), which means that the
ensure_loaded(p) directive in somedir/include_p.pl should behave as if it
occurred in q.pl (which isn't what you expected). When you fcompile q.pl,
you produce q.eco, which contains q.pl and include_p.pl (but not p.pl),
which means the original include-structure is lost.
The cleaner fix seems to me to have pure include-semantics, i.e. in an
included file you would have to assume to be in the includer's directory,
not the includee's.
PRO: SWI Prolog and YAP behave that way.
The fix it the other way (i.e. to make your existing code work), would mean
a less straightforward semantics for include/1, and some ugly trickery in the
.eco files to keep track of the original source code nesting.
PRO: SICStus and C behave like that when compiling (but they don't have the
problem that precompiled files can still contain directives!)