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?
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?
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.