Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Proposal: Automatic longer namespacing and aliasing at import time. #2649
Proposal: Make it convenient for module "namespaces" to be prefixed with an upper camel case of their package name automatically, similar to how their public name (should be) is by convention. Then allow importing them as shorthand:
Motivation: Make it easy for library authors to avoid namespace collisions at link time, but also give them a convenient/standard way to shorten things at consumption time.
Let's suppose there are two packages loosely referred to as "react" (I'm sorry). One might be in the opam package
Could be shorthand for:
Then the second part of the proposal, is the ability to alias modules at consumption time:
This also provides a way to let people resolve any ambiguity if there are two "conceptual Reacts" in the same app:
What this would do is it would create a hidden module called
And then pass the
We should discuss the two proposal separately:
Could you open two different tickets so that it's easier to discuss them independently?
Do you think that the two should be considered separate proposals? I broke off the other independent feature #2648 because I believe it can be considered independently, but for this one, I'm not sure if it's possible to implement one feature without the other (automatically derive name, and shortening on import). The reason is that I think the best automatically derived name would be ugly
Yes. I agree that the automatic name derivation would be less practical without the aliasing of dependencies, but the former would be useful on its own. And at the end of the day, technically none depend on the other and the set of questions to consider is disjoint.