1

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?

Rustang
  • 113
  • 4

1 Answers1

2

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.

MSalters
  • 895
  • 4
  • 11