[m-dev.] Submodule visibility rules
Simon Taylor
stayl at cs.mu.OZ.AU
Tue Jul 2 15:33:15 AEST 2002
On 02-Jul-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Looking up the reference manual on visibility rules for submodules, it
> says that *everything* that is defined or declared in a parent module is
> visible *everywhere* in a submodule.
>
> A quick test shows this to be true.
>
> However, the rule seems odd to me since if a client is allowed to import
> the submodule then it can gain access to names that are local to the
> parent module.
>
> I would have thought that the following rule would be better:
>
> place where | names in parent module visible in submodule
> submodule is |
> included in parent | interface implementation
> |
> interface | yes no
> |
> implementation | yes yes
>
> Any opinions?
The intention is that if the sub-module is declared in the interface,
its interface should only depend on the interface items of the parent.
I'm not sure whether that is checked properly when creating the interface
files, but if a client attempts to use any names local to the parent the
compiler should report an error.
Simon.
--------------------------------------------------------------------------
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