[m-users.] undefined predicate during link!

Sean Charles (emacstheviking) objitsu at gmail.com
Mon Apr 26 05:45:55 AEST 2021


Thanks again Zoltan, all fixed, all built and all fine :)

I must have forgotten about needing to qualify the predicate. The -problem- is that, being a hardened OO person over the years you get used to —assuming— you know how a module system works… I did some RTFM for half an hour and made some notes!

All good.

I wonder what my next issues will be?
Can’t wait!

Cheers,
Sean


> On 25 Apr 2021, at 16:58, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> 
> 
> 
> On Sun, 25 Apr 2021 16:51:32 +0100, "Sean Charles (emacstheviking)" <objitsu at gmail.com> wrote:
>> felt.m
>> :- module felt.
>> :- interface.
>> :- import_module io.
>> :- pred main(io::di, io::uo) is det.
>> :- implementation.
>> :- import_module list, maybe, string.
>> :- use_module options.
>> main(!IO) :-
>>    do_command_line(Flags, Files, !IO),
>>    (
>>        Flags = no
>>    ;
>>        Flags = yes(_Options),
>>        foldl(io.print_line, Files, !IO)
>>    ).
> 
> That is not an undefined predicate during link, that is an
> undefined predicate during compilation.
> 
> The problem is that
> 
> (a) the call to do_command_line is not module qualified,
> i.e. it does not say what module defines this predicate, but
> 
> (b) the line ":- use_module options" tells the compiler
> that all references to the things imported from the options module
> *will* be module qualified.
> 
> So the compiler is telling you it does not know what module
> defines do_command_line, since it "knows" from the use_module
> that it cannot be options.m.
> 
> I will look into improving the error message in such cases.
> 
> Zoltan.



More information about the users mailing list