Also forces people to actually take backwards compatibility seriously.
Also forces people to actually take backwards compatibility seriously.
And I believe Go only using one version is the best solution. It avoids many problems.
And btw: you can force any transitive version in gradle/maven/npm/cargo as well, that’s not a feature unique to Go.
That means you can't use library A and unrelated library B together in the same project, even though you can use A alone and can use B alone. That's lack of orthogonality.
I import a@1 and b@1 a@1 transitively depends on c@1 b@1 transitively depends on c@2
Even with different import paths, I still have two different versions of c in my codebase. It'll just be that one of them is imported as "c" and the other will be imported as "c/v2" - but you don't need to worry about that, because that's happening in transitive dependencies that you're not writing.
You still have the same issue of needing to keep track of all the different versions that can exist in your codebase.
So I'm still not convinced that Go's approach is materially different here - certainly in terms of the practical output, NPM does a good job of ensuring that the fewest number of different versions will get installed for each dependency.
Coming back to a midsized JavaScript codebase after a few months and trying to upgrade to new major versions of things have always been a shitshow.