3 ms·
There is a way to address these things that I'm surprised they don't know about as language designers. For these situations, making a change that breaks people
by kazinator 10y ago
There is a way to address these things that I'm surprised they don't know about as language designers.
For these situations, making a change that breaks people's code, you have a run-time compatibility mechanism. A command line switch or environment variable can tell the language implementation "please behave like version N".
Then all changes since N which are backwards incompatible are suppressed. For instance, troublesome commands that were removed make a re-appearance.
You can then boldly fix something that is obviously wrong, while still giving any negatively affected users a way to fight any fires.
It's not a perfect solution but it placates most of the concern of the form "this is a good all-round fix, but it will break things for some unknown numbers of users".
(Users who have to be absolutely sure that their code will work the same way regardless of language interpreter and run-time updates simply have to package their work together with a specific version of those components, and have their code refer to them instead of the standard installation.)
- scott_s 10y agoI imagine they do know about that technique, and like me, they do not like it. It complicates the implementation itself, as well as the interface provided to the user. I generally would rather pick a side: fix the issue and deal with the consequences, or live with the badness because fixing it would be too big of a breaking change.
- kazinator 10y agoIn my experience using the technique in a language implementation, it is a breeze and the interface to the user is unobtrusive. I imagine they don't know about the technique. Engineers who know about rejected alternatives tend to mention them, to avoid the embarrassment of someone else doing it for them.
- scott_s 10y agoImplementing it and presenting it your users once is easy, and not that obtrusive. Doing it N times is not, and the complexity multiplies. It also increases the complexity of support. I see it as avoiding design decisions instead of making them. Since I don't see it as a viable option, I imagine they don't as well - it doesn't take must insight to realize you can provide an external switch to go between two different behaviors.
- kazinator 10y agoIn my experience, no complexity multiplies. Compatibility switches hinging on different versions for different features in the code are basically unrelated. Sometimes multiple switches affect the same area of the code. This is fairly linear. E.g. if the same logic is affected by two version checks, basically the behavior is split three ways: the ancient behavior before those two versions, the behavior starting with the older of the two versions up to before the later one, and then the new behavior starting with the later version. The code variants do not grow exponentially in N (the number of places in the implementation where a version check is made). That could happen if you introduced individual Boolean controls for individual behaviors rather than a linear scale on version: the same area of code being "hit" by three run-time flags for altering behavior could have 8 possible behavioral combinations and up to as many blocks of code to implement them. I don't see how it avoids making design decisions. If you have a plan for somehow mitigating the impact of backward-incompatible changes so that users can get through them, you have more freedom to uproot bad design and replace it with good design.
- dpark 10y ago> A command line switch or environment variable can tell the language implementation "please behave like version N". That's not a fix. If you tell people running existing code that they need to pass a new parameter to maintain the existing behavior, you've broken them. This is no better than just telling them to update their scripts to call "Invoke-WebRequest" instead of "curl". For the record, powershell already supports this. You can request a specific version of powershell. Most of the time people don't use this functionality, though. > It's not a perfect solution but it placates most of the concern of the form "this is a good all-round fix, but it will break things for some unknown numbers of users". It's actually not a good all-around fix. It might be the best fix for this situation, but breaking an unknown number of users' scripts of unknown importance is still a pretty bad fix. Some guy's payroll processing will break because of this. Some startup's web scraping logic will break. Lots of stuff will break if they fix this. > Users who have to be absolutely sure that their code will work the same way regardless of language interpreter and run-time updates simply have to package their work together with a specific version of those components, and have their code refer to them instead of the standard installation. So basically no expectation of backwards compatibility? That's why Chrome ships with its own copy of Windows, right?
- kazinator 10y ago> If you tell people running existing code that they need to pass a new parameter So, make it an old parameter by having this from the beginning in your language. Once the parameter is several years old, it's no longer a new parameter. Users can use it proactively, before something breaks. It can be a recommended practice for deploying code. > This is no better than just telling them to update their scripts to call "Invoke-WebRequest" instead of "curl". It is substantially better than asking people to change source code. Users can still change their scripts to call Invoke-WebRequests (and should!); just in the short term, they just adjust some version mechanism. > That's why Chrome ships with its own copy of Windows, right? Windows has versioning mechanisms in some of its API's, by which it can tell that a program is calling it that was compiled for an old version. Speaking of browsers, web pages declare what version of HTML they are in with <!DOCTYPE ...>. If your page begins with <html>, you can't expect it to render the same way everywhere. Deploying applications in containers with copies of operating systems is not unheard of these days. > So basically no expectation of backwards compatibility? Backward compatibility is the normal modus operandi. This type of mechanism is just for "oh shit" situations: there is no way we can fix this thing while remaining backward compatible. Any newly introduced use of the version emulation is treated with great regret.