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

From: Joachim Schimpf <jschimpf_at_...311...>
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(...)_at_m or export the predicate:

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

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

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

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

?- (export foo / 1) _at_ 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.3.0 : Wed Sep 25 2024 - 15:13:20 CEST