Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks for the explanation! I'm not sure I personally want to rely on semantic versioning, but if you have a hierarchy of dependencies like that I see how that would be pretty useful.


How do you arrange to never have any transitive dependencies?


I use specific versions of libraries in my app. If two libraries depend on some third library it's rarely an issue, and when it is an issue I often have to resolve it manually anyway.

Ideally I think each library would have its own internal copy of any dependencies, but there are some issues with doing that at least in go.


> Ideally I think each library would have its own internal copy of any dependencies

That works if and only if the library never exposes the use of that dependency, but it can break in horrible ways otherwise.

For example, let's say library foo uses some hash_table package to define some hash table data structure. Foo returns hash tables from its public API. Now imagine your app uses foo, gets one of those hash tables, and passes it to bar.

Bar also uses the hash_table package, but--since dependencies are encapsulated--has its own copy of a different version on hash_table. How is that hash_table code going to handle being given a hash table that was created from a different version of itself?

In a dynamically-typed language like JS, it may work, but this seems super sketchy to me, which is why I think an app should only have a single version of any given dependency.


It's very easy to do that in go by just import path rewriting, ignoring legal consequences, and vendoring.

Perhaps what you want is npm where what you describe is built in, first class, and looked down upon by much of the sane world.


What are the legal consequences of path rewriting? And why would the sane world look down on npm?


Many correlate "sane" with "statically typed". [1]

JacaScript can cope perfectly well with modules A and B relying on different versions of C. It'll often cope even if A calls B with an object it got with C, or some other module broadly compatible with C. Static typing proponents aren't comfortable with the idea, so it's not "sane" to them. Sane or not, many argue it's not just not slowing down the Node community, but actively contributing to its explosive growth.

In C#, you get MethodMissingException if A.DLL and B.DLL refer to different copies of C.DLL and A calls B with an object it got from C, even if the copies of C.DLL are identical.

1: Perhaps I should contrast with strong typing, not static typing. Meh.


Path rewriting means you're distributing modified copies of code, which puts you under significant legal obligation in some cases.

npm is amazing for javascript, but terrible for compiled languages and is especially terrible for security updating; the giant mess of transitive dependencies of the same dependency of varying versions can get messy fast.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: