Live data from Hacker News

Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

github.com

51–57 of 57 posts

Re: Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

#51
ELF shared libraries like Glibc do this at the binary level. If some function changes in a way that breaks backward binary compatibility, then it gets versioned; so that existing compiled programs use the compatibility version.

E.g. suppose that there is a new version of pthread_mutex_lock(&mutex) which relies on a larger structure with new members in it. Problem is that compiled programs have pthread_mutex_lock(&mutex) which pass a pointer to the older, smaller structure. If the library were to work with the structure using the new definition, it would access out of bounds. Versioning take care of this; the old clients call a backwards compatible function. It might work with the new definition, but avoids touching the new members that didn't exist in the old library.

But this is a very low-level motivation; this same problem of low-level layout information being baked into the contract shouldn't exist in a higher level language.

Re: Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

#53

Earlier quoted context omitted.

I think churn in NPM might be an effect of how quickly the browsers and language are evolving. There’s always some new interface that will make your existing code faster or cleaner.

My sense it is cultural. If there's no consequence for breaking stuff then stuff gets broken. Other languages have a stronger culture of shame from breaking stuff.

Some, eg Clojure, have a culture of not breaking things. Having a library that remains unchanged for years is just fine.

Re: Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

#54
post #11
post #8

I agree, it would be nice to have a refactoring workflow that every program modification only creates new functions, never changes existing ones. Then we could get automated testing of new functions against old functions, or even, automated proof that the change doesn't affect the result.

Purely-functional data structures are known for quite some time [1]. I can imagine that the very same approaches can be used to organize functions (the whole interdependency graphs of them), so that an update produces a new version with relevant parts changed, while the previous version remains there, completely unchanged. An IDE, or some other language tool, can fully automate the necessary legwork. (It will of cour…

Unison does this. Every function is identified by a hash of its content, so if the content changes, so does its hash. You can have multiple versions of the same function in the same project without any trouble, because there is never any ambiguity.

Re: Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

#55
post #4
post #2

TL;DR (by ChatGPT) Stopped reading there.

You stopped reading because the author used ChatGPT to create a summary of an article they wrote themselves? This may actually be the best use case for ChatGPT.

Yes, if you can't be bothered to write it, I can't be bothered to read it. It seems that angers some people.

Re: Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

#56
post #3
post #2

TL;DR (by ChatGPT) Stopped reading there.

Why? This is exactly the intended use case of such tech.

The actual use-case for this tech will be spamming, SEO scamming and cheating on homework, as is rapidly becoming apparent.

Re: Ending Dependency Chaos: A Proposal for Comprehensive Function Versioning

#57
Isn’t the proposal simply saying that making libs more granular will solve the problem?

I don’t know what’s everyone else’s experience but I was updating dependencies due to either bugs identified in old versions, because I wanted a new feature or because the old version was not supported anymore. Setting dependency to a fixed version was not an option. Using in your code function with given version fixed seems to be problematic.

During updates the problem was to update all other dependencies as a result of the update. I can’t see how the proposed approach would solve it.

Another problem which I sometimes faced (less annoying) was the api change i.e. start using function B instead of function A which requires slightly different parameters. Those kind of automatic refactors could be supplied with library upgrades (some libs already come with automatic migration “scripts”)

Post reply on HN