Hello !
Probably that's a newbie question, but I'm really lost.
I want to declare an operator (like :-op(500,xfx,-:-).) in a module in a way that I could use it from the application that uses this module.
I want to declare an operator (like :-op(500,xfx,-:-).) in a module in a way that I could use it from the application that uses this module.
In Ciao, operators declared in a module are local to that module, to avoid colateral effects. For the behavior you want, you need to create and use a Ciao package, which is simply a file which will be included in the client source with a :- use_package declaration. That is, if the code which implements the functionality is my_code.pl, you make another file my_package.pl including these two lines:
:- op(500, xfx, -:-). :- use_module(my_code).
and then use the declaration
:- use_package(.(my_package)).
in the client source, instead of use_module(...). Note that the dot in .(my_package) implies that files my_package.pl and my_code.pl are in the same directory as the client source. If you will use that package in several applications, the easier thing is to put those files in a library directory (such as for example the contrib directory of the distribution), change the second line of my_package.pl to
:- use_module(library(my_code)).
and use the declaration
:- use_package(my_package).
in the client source. Other solutions exist, but they are less simple.
-- Daniel Cabeza ============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------