6 guest@cc 2020-06-02T17:09:12 [ImgOps] [iqdb]File:
4067d70c54e0404f4e80c5f8e3fa82… (JPEG, 1.05MB, 1500x2300)
| Speed is not a good reason. Parsing S-expressions is very straightforward and should be quick. Macro expansion could slow things down but theoretically you could have an S-expression based language without them. Meanwhile parsing something like C++ is a hard problem. The language is full of ambiguities and people have been working hard to make GCC's parsers fast.
I assume that at this point it is mostly a question of tradition. The processor itself executes statements (instructions) therefore most of the early languages are also based on statements. Just look at COBOL, adding numbers is done by the statement ADD a, b TO c . Of course this is insanity and people added expressions to their statements, so now you can write return 1+2; in C, which is a return statement with the expression 1+2 as an argument to it.
The reason Lisp is so different is that McCarthy did not design it to be a programming language, but as mathematical notation to reason about programs. It was never meant to run on the machines and he was quite surprised when Steve Russell managed to write the first Lisp interpreter.
>>3 Most Scheme's support structs and have object systems. Even if it is missing, you can write your own. It is discussed in the third chapter of SICP. I would also recommend the paper "Object-Oriented Style" by Daniel P. Friedman. |