elm-lang / elm-package

Command line tool to share Elm libraries
BSD 3-Clause "New" or "Revised" License
214 stars 66 forks source link

Disallow `import Foo exposing (..)` in exposed modules #229

Closed rtfeldman closed 8 years ago

rtfeldman commented 8 years ago

Although elm-package disallows breaking API changes in Minor and Patch versions, it is still possible to publish a Minor version which breaks other packages. Suppose I publish this:

module MyModule exposing (..)

import Foo exposing (..)
import Bar exposing (..)

foo : String -> String
foo arg =
    doSomething arg

If I publish this and Foo exposes doSomething, but Bar does not, nothing bad happens.

If Bar then publishes its own doSomething, suddenly it has broken my module (and anyone who depends on my module) because doSomething has become ambiguous.

Modules which explicitly enumerate all their exposing imports cannot go from unambiguous to ambiguous simply because another package published a new Minor version. This suggests a solution: disallow the use of import with exposing (..) in exposed modules (and their dependencies). This is a bit inconvenient to package authors, but the increased ecosystem reliability seems worth it.

This would only affect exposed modules, so application authors could still break their own builds by upgrading to a new Minor version of a package. However, since that does not disrupt the rest of the ecosystem, that seems like a fine thing to leave up to them. They can resolve it on their own without harming others.

process-bot commented 8 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 8 years ago

Duplicate of https://github.com/elm-lang/elm-make/issues/61 ;)