I'm looking to make a comparison of regularity in languages - specifically orthogonality.

If I were to say Java is weak in terms of orthogonality and Haskell stronger, where would C++ sit and why?

  • 1
    $\begingroup$ C++ gets a bunch of new, complicated features every few years. It never was a simple language, and its simplicity is diminishing across time. This is one of the major complaints against C++. $\endgroup$ Oct 9 '20 at 13:21
  • $\begingroup$ And while one revision design goal has been Prefer libraries to language extensions, it is not just the libraries. $\endgroup$
    – greybeard
    Oct 10 '20 at 6:21
  • $\begingroup$ It wouldn't hurt if you showed your current assessment of regularity and orthogonality in programming languages, and your take on C++. $\endgroup$
    – greybeard
    Oct 10 '20 at 6:40

By many standards, Java would not be considered weak in this respect. Java was not one of the first-generation languages. By the time it was developed, quite a few things were known about language design, and the lessons learned do show. For instance, it's pretty easy to parse.

C++ is quite a bit older, as it shares a history with C. As a result, C++ has the a preprocessor language that is quite distinct from the rest of the language. But unlike C, C++ has effectively added a third language. The C++ template system is Turing-complete, and effectively a language of its own. (Although recent C++ versions have reduced this gap).

The result? This bit of valid C++ code:

#define A 0
enum { b = 1};
const int c = 2;
constexpr int d = 3;

But note that this process is a result of the success. The most orthogonal languages are those defined as a theoretical exercise, never used, and therefore never adapted to be useful for a wide range of tasks.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.