-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider Namespacing library dependencies #40
Comments
I agree that it can be confusing figuring out which packages different imports come from (you're not the first and probably not the last person to bring this up), but I'm not particularly eager to reopen the prefixing/namespacing discussion right now. What probably would make sense, though, would be to annotate the examples much like you've done above, so that people reading the examples can immediately see what's happening. Thoughts? |
Hi Ian, I see it actually used to be that way that the modules were namespaced. Given the history I understand you don't wanna reexamine everything again. Annotating examples: I think that would solve the confusion for beginners. The only problem with it is that once you run Naming collisions: Totally agree that having something like |
Good point about the Are you sure that name clashing also affects indirect dependencies? I don't think that's true...I mean, you certainly get compile errors if you try to import a module in a package you only indirectly depend on (it's happened to me several times that I get a compile error for I also think namespacing at this point is a short-term fix that might avoid some issues in the near term while at a potential cost to the Elm language/ecosystem in the long term. You're right that there hasn't been much recent movement on things like elm/compiler#1625, but until Elm gets close to 1.0 I think things like module import syntax should still be considered to be in flux. And in order to figure out the best solution, Evan et. al. need case studies of where there are issues with the current design...such as instances where naming conflicts actually come up! So any naming conflicts avoided right now by adding a namespace would mean fewer case studies to consider, making it harder to figure out the right long-term solution. On the flip side, if not adding a namespace now means naming conflicts do come up, then there's a bit of pain to work around in the near term, but it provides a good data point for figuring out what the long term module import solution should be. |
Now that you put it that way I am not 100% sure. You may be right about that. If it doesn't affect dependencies that is a very good thing. I may have confused that case with versions because the compiler can not resolve multiple version of the same library as far as I know. I agree with the rest of your statement, that namespacing now will prevent gathering data points for a proper fix in the language.
Not sure if what that bit of pain would be, because I think once you have those issues there's not really anything you can do to my knowledge besides namespace then to avoid it. Having heard your reasoning, I think it's fine to leave module names as they are for now. Since we done quite some "Considering" I think we can close the issue. :-) |
You're definitely right about versions - indirect dependencies can certainly cause version constraint conflicts. (And of course if you use I think it would be possible to work around things in some cases by vendoring certain dependencies into your own repository and placing them under a prefix there; for example you could depend on Anyways, yes, I think we're all pretty clear on what the issues/tradeoffs are so I think I'll close this for now. If at some point it becomes clear that import resolution is not going to change, then I'm happy to reopen the discussion - although ideally as part of a broader conversation within the Elm community, so that there can be some consistency between packages. |
Problem
elm-3d-scene
makes use of bunch of other libraries. A couple of them are not namespaced for people (like me) who haven't used those before it is difficult to see where the imports come from.Suggested Solution
Namespace the modules in the other libraries like
Unit.Length
instead ofLenght
forelm-units
. Other affected libraries areelm-geometry
,elm-3d-camera
and possibly more.Other Implications
Namespacing would also help dodge the fact that the compiler currently cannot diambiguate modules with the same name. See here
Other
If there is a decision to implement what this issue suggests, it may be better to track on the respective repos of the libraries. But until them I felt it would give a better insight over the issue here.
The text was updated successfully, but these errors were encountered: