LLVM talks 1: Clang for Chromium

bearophile bearophileHUGS at lycos.com
Sun Dec 18 08:58:26 PST 2011


Walter:

>Keep in mind that it is IMPOSSIBLE for any static analyzer to prove there are no order dependencies when the order is implementation defined.<

I see.


>D's approach on this allows one to reason reliably about how the code works - this does NOT contribute to making code unreadable.<

Guido V. Rossum was not sure about adding the conditional expressions (X if P else Y) to Python because despite it's possible to reason reliably about them, they sometimes lead to less readable code, and readability is a very important point of Python design.

C code usually doesn't contain many pre/post increments (or related things) in the middle of expressions because many C programmers know that C leaves the meaning of such code to the specific compiler/system.

If the semantics of that code becomes well defined in D, I fear some programmers will feel free to use that kind of code more often (and that kind of code _is_ often not much readable).

So programmers need to not misuse the tools a language gives them, but on the other hand the language designers must take care of not giving too much trust to the programmers, to help keep programs more tidy. It's a matter of balances and trade-offs.


>D isn't designed to be ported to C/C++. D is full of features that are not reasonably portable to C/C++. It's a completely irrelevant point.<

I understand. On the other hand I have spent a good amount of time porting/translating code between different languages, so I am sensitive to this issue. I have grown further dislike for:
- Languages that have a particularly not explic syntax (example: sometimes Perl);
- Original code without unittest. Unittests are good when you translate code in another language, because they help you trust that the translation is done correctly;
- Not readable code in general, like C code with expressions that contain lot of pre/post increments (this is what we were discussing in this part of this thread).
- Languages that seem to differ in some details from each other only because they seem to want to be different. How many different ways there are to do the same things? Sometimes I'd like a bit more syntactic standardization of small things/semantic bits that many languages share. Language don't need to look all the same, but there is no need to invent twenty different syntaxes to test if a number is bigger than another number.
Languages are not used alone, most programmers live in a world of more than one language. Translating code between different languages seems a fact of a programmer's life.

Bye,
bearophile


More information about the Digitalmars-d mailing list