[m-dev.] shims

Peter Wang novalazy at gmail.com
Tue Sep 16 15:58:43 AEST 2014


On Tue, 16 Sep 2014 13:09:09 +1000, Mark Brown <mark at mercurylang.org> wrote:
> On Tue, Sep 16, 2014 at 12:05 PM, Peter Wang <novalazy at gmail.com> wrote:
> > On Mon, 15 Sep 2014 16:23:07 +1000, Mark Brown <mark at mercurylang.org> wrote:
> >> On Mon, Sep 15, 2014 at 3:46 PM, Peter Wang <novalazy at gmail.com> wrote:
> >> >
> >> > Is it fair to think of each if-then branch declaring something like an
> >> > anonymous nested sub-module, with forwarding of predicates and types
> >> > from the parent module to the sub-module?
> >>
> >> Exactly. That was the motivation for the syntax, too.
> >
> > Hmm, it should be possible to qualify names within a branch,
> > but if "branch sub-modules" are unnamed then it's a bit hard to do.
> 
> Just qualify them with the containing module. (Or is there some
> situation in which that wouldn't work?)

I think this is misleading:

    :- module m.
    :- pred p.
    :- if [ ... ]
	p :- m.q.
	:- pred m.q.
	m.q.
    ...
    :- end_if.

    r :- m.q. % error?

The module qualification suggests that q exists at the level of the
containing module m, rather than a sub-module of m.

Peter



More information about the developers mailing list