-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
If importing two modules, Elixir immediately complains about any potential names conflict, even for names that are not used in the importing module.
I suggest that the Haskell-like behavior of defering conflict complaints to the point of actually using the ambiguous name is preferable.
That is:
defmodule Foo do
def foo do ... end
def baz do ... end
end
defmodule Bar do
def bar do ... end
def baz do ... end
end
defmodule Baz do
import Foo
import Bar # This triggers an error today; under the new proposal, it wouldn't.
def valid do { foo, bar } end # This will compile cleanly
def invalid do baz end # This will trigger a compilation error
def workaround do { Foo.baz, Bar.baz } end # This, however, will work as expected
end
The current mechanism is too strict in that adding a function to a module can cause compilation to break in modules down the line, making the whole system more fragile (at compile time). The current workarounds (adding only
or except
) are "tedious" compared to simply ignoring potential-but-not-actual conflicts.
Metadata
Metadata
Assignees
Labels
No labels