[m-users.] Creating an interface module

Sean Charles (emacstheviking) objitsu at gmail.com
Fri Jul 14 18:04:32 AEST 2023


What about 

:- publish_module foo.

or

:- export_module foo.


This imports all the interface things from foo and literally re-exports them as though they were declared inline?



> On 14 Jul 2023, at 09:02, Volker Wysk <post at volker-wysk.de> wrote:
> 
> Am Freitag, dem 14.07.2023 um 17:41 +1000 schrieb Peter Wang:
>> On Tue, 11 Jul 2023 16:59:42 +0200 Volker Wysk <post at volker-wysk.de> wrote:
>>> Hi
>>> 
>>> In Haskell, you can import things into a first module from a second module
>>> and reexport them from the first one. So you can use the first module as an
>>> interface to things from several modules.
>>> 
>>> This doesn't seem to be possible in Mercury. You need to import all the
>>> modules which contain parts of what you need. 
>>> 
>>> Submodules don't seem to be the answer.
>>> 
>>> Am I missing something? What is the recommended practice when you want to
>>> split a library into several modules?
>> 
>> Mercury's module system is pretty basic and doesn't support
>> re-exporting.
> 
> I can think of a solution that looks easy to implement. In a module there
> could be some statement ":- import_as_well(...)", which tells the compiler
> to import some other modules as well, when the module with the statement is 
> being imported.
> 
> Cheers,
> Volker
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users



More information about the users mailing list