Re: [eclipse-users] Library Induction

From: Kish Shen <kish.shen_at_crosscoreop.com>
Date: Thu, 26 Apr 2007 16:49:42 +0100
Hi Siddharth,

This discussion is probably getting too specific about your porting problems, so it is probably
best if you send any further e-mails about this to me only, unless you feel there is some
general interest for everybody on the mailing list.

On Thursday 26 April 2007 05:11, you wrote:
> That was helpful. That change recognized use_module/3. Theres another
> problem though:
> 
>  while executing the statement :
>                     :- multifile prolog:message/3.
> 
> I get the error:
> -----------------------------------------------
> WARNING: declaring multifile procedure(s) as dynamic in multifile
> prolog : message / 3
> 
> not a module in dynamic message / 3
> -----------------------------------------------
> 
> The above statement is followed by a definition of a message/3
> predicate. But no predicate
> is defined as dynamic. Whats this?
> 
The behaviour you are seeing is due to the execution of code in lib(swi), and so the best way to
find out what is going on is to look at what the code for multifile/1 is doing in swi.ecl -- it is
just another ECLiPSe program.

For the multifile predicate, you can see it from the code fragment from swi.ecl I sent you earlier:

:- reexport
	(multifile)/1, op(_,_,(multifile)),
        use_module/2,
        ensure_loaded/1,
	format/2,
	format/3
    from quintus.

i.e. it is imported from the quintus module, i.e. from the file quintus.pl (this is the Quintus 
Prolog compatibility module, which is used by other compatibility module such as swi).

In quintus.pl, there is a tool declaration for multiplefile/1:

	tool((multifile)/1, multifile_body/2),

and the predicate multifile_body/2 is as follow:

multifile_body(Files, M) :-
	write('WARNING: declaring multifile procedure(s) as dynamic in '),
	writeln(multifile(Files)),
	qdynamic_body(Files, M).

this is why you got the warning: multifile/1 is implemented in lib(swi) by declaring the 
predicate as dynamic. This is because dynamic predicates in ECLiPSe are treated (for
compilation purposes) like the multifile predicates of SWI. A warning is given because
dynamic predicates are not executed efficiently.

The error you do get seems to be related to the prolog:message/3 part, probably because
prolog is not an existing module. SWI Prolog will create a new module when one does not
exist, but ECLiPSe does not. This is one of the differences between the module systems
that Joachim mentioned, and I am not sure if we want to emulate this in the swi
compatibility mode.

Cheers,

Kish
 
Received on Thu Apr 26 2007 - 16:51:08 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET