Closed Jean-Luc-Picard-2021 closed 5 days ago
LoL, its even worse in Scryer Prolog:
$ target/release/scryer-prolog -v
v0.9.4-201-gc39ea481
$ target/release/scryer-prolog
?- ['mod/foo.p'].
error(domain_error(directive,todo_insert_invalid_term_here),load/1).
Trealla doesn't support random predicate calls as directives, like SWI-Prolog does.
I expect Scryer doesn't either.
Make [_|_]
a directive, or else throw an error.
Now it is silent and hence very difficult to debug.
Especially when porting code that works in SWI-Prolog.
Top-level shortcuts should never be used in source files. Throwing an error is the best and compliant option here.
Some error is thrown, but it has still a bug somewhere.
Just compare Trealla Prolog with Scryer Prolog. Trealla
Prolog does not lookup use_module/1
argument relative to
the parent file, or maybe its an file name extension problem?
~/trealla$ ./tpl
?- ['../shared/foo'].
Warning: module file not found: bar
true.
Scryer Prolog can lookup use_module/1
argument correctly:
~/scryer-prolog$ target/release/scryer-prolog
?- ['../shared/foo'].
true.
?- bar.
hello
true.
The test cases are, placed it in a ~/shared folder:
bar :- write(hello), nl.
:- use_module('bar').
The bug is a little annoying, since I cannot share Prolog text files among two Prolog systems. Have always to copy the stuff or otherwise modify it to fix the bug.
Ok!
$ ./tpl -v
Trealla Prolog (c) Infradig 2020-2024, v2.59.5
~/trealla$ ./tpl
?- ['../shared/foo'].
true.
?- bar.
hello
true.
Somehow either a file is silently not consulted, or a predicate doesn't become visible. Could be a backward compatibility problem form ISO modules to ISO core. Since non-modules should have all
predicates automatically exported? If I do in Trealla Prolog I get:
If I do in SWI-Prolog I get:
The test case is relatively simple, a directory mod, with two files:
bar.p.log foo.p.log