JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.92k stars 5.49k forks source link

Clearer error for conflicting exports #51184

Open ParadaCarleton opened 1 year ago

ParadaCarleton commented 1 year ago

A user in Slack was confused about this error message. I think "qualified" is probably a bit confusing to new users who might not know what it means:

 WARNING: both Turing and StatisticalRethinking export "HMC"; uses of it in module Main must be qualified
ERROR: UndefVarError: HMC not defined

Suggested replacement:

WARNING: both Turing and StatisticalRethinking have a function called "HMC." Specify which one to use with "Turing.HMC" or "StatisticalRethinking.HMC".
ERROR: UndefVarError: HMC not defined
jishnub commented 1 year ago

Looks like it's defined at https://github.com/JuliaLang/julia/blob/78e0ca37dbdb3399f44731731cc3ee7165bd8929/src/module.c#L338

adienes commented 1 year ago

I sometimes wish the word "disambiguated" had been chosen there. But it's my understanding that a "fully qualified name" is a pretty standard term for this in a broader context (not just Julia)

jariji commented 1 year ago

Suggesting code would be a nice next step for error messages, eg

Replace `HMC` with one of:

  Turing.HMC
  StatisticalRethinking.HMC