[m-dev.] trivial diff: update list of std library modules

Fergus Henderson fjh at cs.mu.OZ.AU
Mon May 22 21:46:23 AEST 2000


On 22-May-2000, Ralph Becket <rbeck at microsoft.com> wrote:
> It seems a little odd to have library module names hard coded into the
> compiler.  It looks like it's the MLDS that needs this info - is
> mercury_std_library_module/1 just a workaround for some problem?

The reason that the compiler needs to know which modules are standard
library modules is that the name mangling algorithms that it uses
treats those modules differently.

In particular, when you're looking at things from the Mercury side,
the Mercury standard library modules don't need to have a special
prefix, since they are well-known, and it is the responsibility of
the programmer to avoid using those names.  Alternatively, if they are
to have a special prefix (as is planned for version 2 of the standard
library), it can be something short and simple like `std'.

But if you're compiling Mercury to C, C++, Java or some other language,
then it's not OK for the Mercury standard library to use names like
`io' or `std' for header files or prefixes, since it might cause
name clashes with entities defined by the OS or the target language.
Instead, they should use some prefix that includes the name `mercury'.

Thus it must be the responsibility of the Mercury compiler to
insert a `mercury' prefix for the standard library module names.
Since the current standard library is not enclosed in a single
namespace, this currently requires hard-coding the names of all the
standard library modules.  When we move to version 2 of the standard
library, and make everything in the standard library as sub-modules of
a single `std' module, then mercury_std_library_module/1 will still be
necessary, but it will be simpler -- it will only have to recognize
the `std' prefix.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list