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

From: Paulo Moura <pmoura_at_logtalk.org>
Date: Wed, 24 Oct 2012 09:26:18 +0100
On 24/10/2012, at 00:18, Joachim Schimpf <jschimpf_at_coninfer.com> wrote:

> On 24/10/2012 01:06, Paulo Moura wrote:
> ...
>> [eclipse 28]: create_module(n, [], []).
>> 
>> Yes (0.00s cpu)
>> [eclipse 29]: assert(bar(99)) @ n.
>> 
>> Yes (0.00s cpu)
>> [eclipse 30]: call(bar(X)) @ n.
>> calling an undefined procedure true in module n
>> Abort
>> 
>>> From the manual:
>> 
>>    create_module(Module) :-
>>        create_module(Module, [], eclipse_language).
>> 
>> Thus, it seems my mistake was to omit the "eclipse_language" in the imports argument.
> 
> Whether it's your mistake is debatable ;)
> 
> create_module(m,[],[]) makes a really empty module, i.e. one that doesn't
> even have any built-in predicates visible, in particular not true/0.

So, there's no true in an empty module :-)

> If assert/1 didn't turn bar(X) into (bar(X):-true) your example would work
> anyway.  In fact, it works if you use compile_term/1 instead of assert/1...


Thanks for the explanation. I would not have guessed it.

Cheers,

Paulo


-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:pmoura_at_logtalk.org>
Web:   <http://logtalk.org/>
-----------------------------------------------------------------
Received on Wed Oct 24 2012 - 08:26:35 CEST

This archive was generated by hypermail 2.2.0 : Sun Oct 28 2012 - 06:13:14 CET