Re: [eclipse-clp-users] Making a predicate asserted into a dynamic module visible

From: Joachim Schimpf <jschimpf_at_coninfer.com>
Date: Wed, 24 Oct 2012 00:57:11 +0200
On 24/10/2012 00:16, Paulo Moura wrote:
> Hi,
>
> I'm running an experiment where I create a module at runtime (with create_module/3), assert
> clauses into it, but cannot call the asserted predicates (using :/2). Inspecting the module, it
> seams that the visibility for asserted predicates is local. Am I missing something obvious?

:/2 can only call exported predicates, so that's consistent.

Use either call(...)@m or export the predicate:

?- create_module(m).
Yes (0.00s cpu)

?- assert(foo(99)) @ m.
Yes (0.00s cpu)

?- call(foo(X)) @ m.
X = 99
Yes (0.00s cpu)

?- m : foo(X).
calling an undefined procedure m : foo(X) in module eclipse
Abort

?- (export foo / 1) @ m.
Yes (0.00s cpu)

?- m : foo(X).
X = 99
Yes (0.00s cpu)


-- Joachim
Received on Tue Oct 23 2012 - 22:57:20 CEST

This archive was generated by hypermail 2.2.0 : Wed Oct 24 2012 - 06:13:58 CEST