[comp.lang.prolog] Compiling Arity Prolog

kv@aipna.ed.ac.uk (Karen Valley) (05/27/90)

Hi,

I don't normally read this group so apologies if this has been done to
death in the past.

I've been banging my head off of a brick wall for the past few weeks
trying to compile some Arity Prolog to make a stand-alone program, and
it's driving me mad. I won't bore you with the details, but here's a
trivialised version of the problem:

File 1: compiled file. 

:- public main/0

main :- start.

start :- reconsult(foo), call(go).

File 2: foo.ari

go :- write('I am here').


Why does the stand-alone version fail when it gets to call(go)? More
importantly - how can I get it to work? It will work if the call is
changed to 'call(go(here))' and go is changed to 'go(here).' only, i.e.
no conditional predicates, but I need to be able to run code.

I'd rather not compile File 2 as the files loaded at run-time depend on
choices the user makes.

Any suggestions by e-mail to kv@uk.ac.ed.aipna. Thanks in advance,
Karen

weiss@theory.lcs.mit.edu (Paul G. Weiss) (05/29/90)

Karen's program fails when it gets to the write/1 predicate.  In Arity/Prolog
we have visible declarations, which are a way to tell the interpreter which
predicates are to be visible at run-time.  Having all the builtins visible
for every standalone application would force them all to be linked in to
every standalone application, making them bigger than they would otherwise
have to be.  Therefore, we let the programmer either decide that 

(i) all builtins should be visible,  or
(ii) only selected ones (which is the default)

In the case in question, the insertion of the line:

:- visible write/1.

in the first file would cause the program to work correctly.