[m-dev.] "Did you mean ..." messages for module qualifiers
Julien Fischer
jfischer at opturion.com
Mon Jan 13 23:06:34 AEDT 2025
On Mon, 13 Jan 2025 at 22:54, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> > > > Question: should we generate "Did you mean ..." messages for module qualifiers?
> > >
> > > Yes, if we can. Generating dym messages requires knowing either *the* set of
> > > possible spellings you may mean, or a reasonable subset of that set. In this case,
> > > I am pretty sure that the compiler does NOT (currently) have access to the full
> > > set of module names in the program. It does have access to the subset of that set
> > > consisting of the set of imported and included module names, but that would not help
> > > in this case.
> >
> > I disagree, if the unknown qualifier is within a sufficiently close
> > edit distance of some of
> > the imported or included modules, then it is very probable that the
> > user meant the
> > qualifier to be of one of those and just entered it incorrectly.
>
> Agreed, but your email did not say anything about the ranges module being
> imported, so I assumed it wasn't.
To be clear; the ranges module was imported in my original example.
> > > Whether that would be big enough for dym messages to be useful depends on
> > > the kinds of misspellings people tend to write, and that is quite individual-dependent.
> >
> > I think we would probably limit it to candidates that are within one
> > or two edits of the
> > unknown name.
>
> We do not do so for other kinds of dym messages. The heuristic for "how big
> a difference is too big" is something we took from (I think) gcc, and it is
> dependent on name length, I think about one third replacement being the limit.
Whether that same heuristic is applicable to all the kinds of entity,
you may want
to generate dym messages for is an open question. I suggest we just start by
using the existing heuristic and adjust if necessary.
Julien.
More information about the developers
mailing list