julia icon indicating copy to clipboard operation
julia copied to clipboard

[1.12] `WARNING: using Foo in module Main conflicts with an existing identifier.` warnings gone

Open adienes opened this issue 6 months ago • 4 comments

I'm sorry to duplicate this question in several places but I'm having a tough time getting an answer: in 1.12 it seems that in cases like

julia> x = 1
1

julia> module Foo
           export x
           x = 2
       end
Main.Foo

julia> using .Foo
WARNING: using Foo.x in module Main conflicts with an existing identifier.

a warning is no longer emitted. I'm sure of course this is related to all the const redefinition stuff, but to me this seems like a UX regression as patterns like this are a common footgun and rarely intended. was this removal intentional? if not, could it be restored?

adienes avatar Jun 10 '25 13:06 adienes

This never should have emitted a warning in any version, as that would have been a bug. Indeed, checking v1.8-v1.12 I don't see any warning accidentally present when testing that snippet.

vtjnash avatar Jun 10 '25 13:06 vtjnash

sorry, I forgot the using .Foo in my MWE.

adienes avatar Jun 10 '25 13:06 adienes

Okay, that for loop was removed in 888cf0350668a677ef27c87ab80a8562f3bc211e

vtjnash avatar Jun 10 '25 14:06 vtjnash

yes --- and I am currently presuming (maybe incorrectly) that it was removed under the perspective of "this is no longer illegal." but from the perspective of user-friendliness, this does seem like the kind of place where a warning should be emitted. do you have any thoughts on re-adding the warning?

adienes avatar Jun 10 '25 14:06 adienes

I don't think there is any intent to add back that loop, though someone could make a PR and force a decision before v1.12 releases

vtjnash avatar Sep 17 '25 15:09 vtjnash

"not planned" is all good, I just was worried it was accidental. I suppose the manual does say

Technically, the statement using ModuleName means that a module called ModuleName will be available for resolving names as needed. When a global variable is encountered that has no definition in the current module, the system will search for it among variables exported by ModuleName and use it if it is found there.

which implies it may skip searching ModuleName if it finds the global already (without a warning)

adienes avatar Sep 17 '25 15:09 adienes