[m-users.] Creating an interface module

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


LOL! I considered reexport first! But I didn't like the two 'e'-s close together, I agree with all your other points!

> On 14 Jul 2023, at 09:14, Volker Wysk <post at volker-wysk.de> wrote:
> 
> Am Freitag, dem 14.07.2023 um 09:04 +0100 schrieb Sean Charles
> (emacstheviking):
>> 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?
> 
> I'd call it ":- reexport_module ...". The difference is that in your
> suggestion, the reexported things become part of the reexporting module,
> whereas in my suggestion, they stay part of the reexported module. 
> 
> I'm not sure what is preferable, but I guess that my suggestion would be
> easier to implement. But then you have to cope with it not being obvious to
> which module somethings belongs...
> 
> Volker
> 
>> 
>> 
>> 
>>> 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
>> 
> 
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users



More information about the users mailing list