|
|
|
|
|
by js8
3120 days ago
|
|
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. |
|
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.