Hacker News new | ask | show | jobs
by gjjrfcbugxbhf 3118 days ago
Why? Your revision history is already in version control.
2 comments

With VC, you can only call the latest version. With versioned functions, all the old code would still call the old functions, until you would explicitly refactor it (or type system would fail).

I guess there is a philosophical debate behind this - what's in a name? Should a name of function refer to a specific body of code only, or all possible function bodies, past and future? What did the caller of the function want?

You can only guarantee correctness if the former. But the latter gives you more flexibility. I am not saying that this is the right answer.

Sounds similar to https://thedailywtf.com/articles/best-of-2016-the-inner-json...

Keeping all versions of the same method in the source files has a lot of drawbacks:

1. Readability. Autocomplete gives me 50 versions of that method. Which one do I choose? The latest? Why do the rest need to exist?

2. Code size. Can you imagine the compilation times? IDE indexing times? Binary size?

3. Consistency / Correctness. How do you know when each call should update it's version. How do you increment all calls to the latest version?

Simplicity is the ultimate sophistication.

You could see this proposal as tighter integration between version control and the language proper, which has the potential to solve a lot of problems. E.g. there's a common problem with diamond dependencies: if A depends on B and C, and B depends on D, and C depends on D, what do you do if the versions of D they depend on don't match?