How do programming languages ​​support backward compatibility and correct design errors?

As you know, have you read some of my other questions, I am writing a programming language. One of my serious problems is that many languages ​​have backward compatibility issues, and I want to avoid such problems. For one thing, I saw a lot of pain and agony in the Python community over switching to Python 3000 because it breaks backward compatibility. On the other hand, I saw C ++ that started with binding to the C syntax and never recovered; those. C syntax is bad for many C ++ constructs.

My solution is to let programmers add a compiler directive to a file that tells the compiler which version of the language to use when compiling. But my question is: how do other languages ​​deal with this problem? Are there any other solutions that have been tried, and how successful were these solutions?

+3
source share
6 answers

When something is broken, the courageous language designer should not be afraid to break compatibility. I know two good ways to do this:

  • The Glasgow Haskell compiler typically depreciates unwanted features and then drops support after two versions.

  • Lua , ( 1995 5) , , . ( , , - 5.1, Lua 2.5, , Lua 2.5, .)

+7

:

, . . , , , - . , " ", .

+6

, . , .

, - :

if ( language_major_version > 2 )   // 2.00.00 and above
    ... normal processing ...
else
    ... emit compatibility/deprecation error ...

VoiceXML, XML , :

<?xml version="1.0"?>
<vxml version="2.1">
    ...
</vxml>

- XML, , ,

+2

: , . , .

, , , .

  • , , -

  • . , /

  • .

  • , -, . , , "" .

  • ,

  • " " , , , .

, , .

+1

In general, you still support all old features for at least one new version, although two versions in the future are desirable. The function then depreciates, and the user of your language updates their applications before the function is removed from your language.

0
source

I forgot another way that languages ​​dealt with backward compatibility: Stubbornly insist on never updating the language. See Donald Knuth TEX Example.

0
source

Source: https://habr.com/ru/post/1714937/


All Articles