Re: [m-users.] Module include and undefined symbol.

Julien Fischer <[email protected]> Sat, 24 Aug 2024 23:06:17 +1000
Newsgroups gmane.comp.lang.mercury.general
Message-ID <CAFFSLtjpfhhUZY50gMH5WW0QxWYBShKWfquZG7OzmuiNGe9yNA@mail.gmail.com>
On Sat, 24 Aug 2024 at 22:10, Sean Charles (emacstheviking)
<[email protected]> wrote:
>
> I have a module called `core` in file core.m
> I have a sub-module called `core.comments` in file core.comments.m
>
> :- module core.comments.
>
> :- interface.
> :- import_module io.
> :- import_module fm.
>
> :- pred comment_line(opstate::in, opstate::out, dstk::in, dstk::out, io::di, io::uo) is det.
> :- pred comment_parens(opstate::in, opstate::out, dstk::in, dstk::out,io::di, io::uo) is det.
>
> and my parent module is defined like this:
>
> :- module core.
> :- interface.
>
> :- import_module bool.
> :- import_module io.
>
> :- import_module fm.
> :- import_module vm.
>
> :- implementation.
> :- import_module list.
> :- import_module string.
>
> :- include_module comments.   %% <====
>
> :- import_module dstack.

You need to import core.comments in the core module as well as include
it, otherwise what
core.comments exports won't be visible to it.   (What's defined in
submodules is *not* automatically
imported into their parents.)

Julien.
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users