Re: [m-users.] Creating an interface module

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
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 <[email protected]> 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 <[email protected]> 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
> > [email protected]
> > https://lists.mercurylang.org/listinfo/users
>

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmSxA88ACgkQ+K4ydFOs
HoW6+g//Sn6amYIMVHRuaGOTADIvZSG0EvqU6Og0Vf0WtySd+L/QUVk9XgBeg74Z
0OK2qGBrxBJbF8UNt1Hj4skChR28hWJyWiZOqgF86mhrMbioHJpF2vXIhfU5LTfn
Z3PXD3FaRWPE8tCAYrYrbgB5lnjhtJIH1geqXEWpkxwDS/41wvsmGYKtjyqilJap
6w+LodYBY6B909p2z7gI0le4kI3dAW73hoMoj+nYhNPPs3Hf7MZEvF9yiHl1O1n7
M/yCFcF84irgACVecqin8FUFqQ7t/CJ74oH7mArYJlDpxEHwiPK+ZonHon37TgV7
8rdLvCU8ddb4NiuJkDvt1p3EMQ+uQYxUnQ9rJp4VXORWH+GyxiExasy8wlFYeHVy
/gQaXgzZvFD5YC5Gz+z106blSX8ZVUa87BBm23suh+8DetqpMP9VTmteI64zMx5A
epWZ7EDjXRU8zDdUAbbeBrEwoSCGSihjsKQb2ITCA0X6o3HrS/+veDjAO5avultH
I3GgqJnySzs2b140g3h8FkJJC9HCpl4XW5OT0s6TjgBZ9TZT9N87AnoxjZyeYDeo
8xvwnf2WcGverQAqu9t817iORJKRNq/uo+tpKhyeMDWQPJ9L84bcVsZYGejYfQiP
wrpXonuFFIs7Hw9c2nUVH3DJUc9qYefaUet2HLVFgKy+mRTyjLE=
=M8Zn
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.