Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

New keywords are like the textbook example of a backwards compatibility problem. It's probably why C overloads "static" so many different ways.


You can sort of add new keywords backwards-compatibly using a trick called "contextual keywords": you require that they be placed in a syntactic position in which no identifier could legally go, and you maintain them as legal identifiers for compatibility. C++ used this trick to introduce "final" and "override" by moving them before the opening "{".


You mean new reserved words? For example, I'm quite sure when C# added "record" it didn't break backward compatibility, as old code that uses "record" as a variable name still compiles.


Go has made changes like that by adding new predeclared identifiers ("any" is an example, I think?) but there's a distinction between predeclared identifiers and keywords.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: