Monday, February 01, 2016

[wlniiyob] Obsoleting C and C++

Create a programming language that guarantees the equivalent performance and linkability as C and C++ but also better features, probably richer types and functional programming.  Let "most" code currently written in C and C++, code not using bizarre or extremely low-level C and C++ languages features, be easily and automatically translatable to the new language.  (Is it possible to reliably detect whether given code is not using those bizarre features?  Try running the translator on IOCCC.)  This allows further development of the code to happen in the new language with its improved features.

The catch is, the performance guarantee only holds for code written in a backwards-compatible subset of the new language, the subset used in code translated from C and C++.  If development continues in the new language and begins to use some not backward compatible language feature, then the chunk of code that uses it (ideally, just that chunk, and not the whole program, though this is fuzzy) might no longer meet the performance guarantee. (However, this chunk of code might not be performance critical.)  One can imagine that when the compiler recognizes that a chunk of code is written in the backwards-compatible subset, it translates it back to C or C++ and then runs the C or C++ compiler on the back-translated code.  One tricky aspect is that C and C++ compilers have a great many tuning and optimization options, for example, profile-guided optimization, which the new compiler would also have to make available to meet the performance guarantee.

Inspired by how "do" notation in Haskell resembles imperative code.  Also inspired by a chess program for which performance is paramount, but having a high level language to express and safely experiment with new complicated features would be desirable.

No comments :