Dear Bartek,
in fact, you are very right...
Some history first: the idea of 'exporting' syntactic extensions is indeed the basic objective that we had from the start when designing the concept of packages. Note that when you use a Ciao package (say, functions) in a module the *effect* is exactly that: you get access to some predicates that you can call, and you 'import' some operators, expansions, etc. For example:
%% This is file package_m :- include(exported_ops_m). :- use_module(m). %% end
If the package is then loaded as:
:- use_package(package_m).
(which is really just :- include(library(package_m)).) the net effect is indeed that you 'import' the predicates exported by module_m, and also 'import' the syntax extensions defined in exported_ops_m.
Now, the current implementation of packages (making explicit includes, etc.) is just the simplest way to make it work with the basic pieces of the current version of the module system.
However, we have been discussing for a while a more elegant user view of the process, essentially along the lines of what you mention. The idea is to simply hide away the details of the includes, etc.
In one possible user interface you would have a section of the module which would contain exported syntax extensions (i.e., you would put essentially the contents of exported_ops_m there). A simple way to do this (due to Daniel Cabeza) is to say that anything that appears before the :- module declaration in a module would be included into the module that loads it. This would simplify the design of packages by collapsing two of the three files that are typically used. (note that you still would need a separate file for the expansions, the ones that you load into the compiler with load_compilation_module). This general solution is relatively easy to implement. We simply have not had time to do it yet.
An alternative user interface is to have explicit new export declarations for operators. But note that it is not just operators: there are also expansions, multifiles, etc. So, in the end it is not so clear that having new export declarations for these is really the best solution.
Any comments (also from the rest of the user community) are welcome.
MH & the Ciao developers