[m-dev.] "Did you mean ..." messages for module qualifiers
Julien Fischer
jfischer at opturion.com
Mon Jan 13 16:26:33 AEDT 2025
Hi,
Currently, if a module qualified name has a module qualifier that does not
match one of the imported modules, or the module being compiled, we generate
an error message like the following:
foo.m:013: In clause for predicate `main'/2:
foo.m:013: error: call to undefined predicate `range.bar'/2.
foo.m:013: (The module `range' has not been imported.)
The module `range' not being imported is one possible cause for this error.
Another possible cause for this error, as here, is that the user has
incorrectly typed the name of a module (in this case `ranges'). In my opinion,
some form of the "Did you mean ..." messages we generate in other circumstances
would be also be useful here, if we find a unrecognised module qualifier we
compute its distance from the names of the visible modules and report any that
are close enough.
Question: should we generate "Did you mean ..." messages for module qualifiers?
If so:
The way we currently generate DYM messages will result in there being multiple
parenthetical parts in the error message:
foo.m:013: In clause for predicate `main'/2:
foo.m:013: error: call to undefined predicate `range.bar'/2.
foo.m:013: (The module `range' has not been imported.)
foo.m:013: (Did you mean `ranges'?)
I think we need to generate DYM messages differently in this case, here's
one suggestion:
foo.m:013: In clause for predicate `main'/2:
foo.m:013: error: call to undefined predicate `range.bar'/2.
foo.m:013: (The module `range' has not been imported -- did you mean
foo.m:013: the module `ranges'?)
Question: if we do find visible modules that are "close enough", should we even
report the bit about the module not being imported?
Julien.
More information about the developers
mailing list