Module aspect is provided to bring compatibility between Mercury and other languages by replicating the functionality of the
Module keyword in Basic.
Modules are a special type of static class, whose members become part of the global scope, whenever the class itself is in scope. This allows access to the static members directly and without prefixing the class namne, as if they were declared as true globals.
In Mercury, a module is declared by replacing the
Class keyword with
Module; modules are automatically assumed to be static (
Shared, in Mercury terminology).
Marking a static class with the
Module aspect works in any of the elements languages that support classes (i.e. all languages except Go), and has the same effect. Modules can be consumed from all Elements languages and, on .NET from Microsoft Visual Basic.NET.