Re: [eclipse-clp-users] module visibility

From: Joachim Schimpf <joachim.schimpf_at_infotech.monash.edu.au>
Date: Sun, 09 May 2010 15:55:37 +1000
Aya Saad wrote:
> 
> I have defined a new module and called it "test"
> the following is the code in the test.ecl
> 
> %%%
> :- module(test).
> :-lib(ic).
> :- export op(650,xfx,'mytestop').
> 
> X mytestop Y :- writeln("test module visibility").
> %%%

You have only exported the infix-declaration, not the predicate itself.
You probably want both:

:- export mytestop/2.           % export the predicate
:- export op(650,xfx,mytestop). % allow operator syntax for it


> 
> now when I try to type in the Query Entry of the Toplevel ECLiPse 6.0 
> the following:
> X mytestop Y
> by keeping the top level eclipse module 
> ECLiPse cannot recognize the operator; yet it is compiled and operator 
> was exported in test

Exporting isn't enough, you also have to import!  Importing
is done by use_module/1 or lib/1, or explicitly with import/1.

?- use_module(test).
...
test.ecl   compiled 72 bytes in 0.06 seconds
Yes (0.14s cpu)

?- a mytestop b.
test module visibility
Yes (0.00s cpu)


> The point is I need to further include this module into another file and 
> call the operator
> using the 
> 
> %%%
> :- use_module(test).
> mynewgoal :-  X mytestop Y.
> %%%

This should work. Try again.


> What if I have multiple modules which I need to use? 
> How can I make them all visible from the top level? 

You need to have them imported (see above) into the module
that is selected as the toplevel module.


-- Joachim
Received on Sun May 09 2010 - 05:55:40 CEST

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