← Back to context

Comment by robotresearcher

1 month ago

Historically we almost entirely moved from ASM to C, a language with lots of undefined behavior, because precision is not the most valued feature of languages.

When I say "best part of any programming language" I obviously mean "best part of the in-spec defined parts of any programming language".

Your suggestion that because languages have specified undefined behaviour, they are somehow not precise, makes little sense.

  • It's the existence of UB that is the reduction in precision. A language without UB is more precise, in my view, than one that has UB. I don't know if this a conventional view. But being able to write parsable, compiler-receivable code that does 'uh, whatever', feels like a reduction in precision to me compared to a language that does not have that property.

    Otherwise, we're just saying that the precise parts of the language are precise, which isn't much of a differentiator since it's similarly true for all languages.

UB is about edge cases that a compiler should not be enforced to check against and an occurrence is always a bug. You don't necessarily need a precise description of the actual faulty behavior.

  • Right. The language has well-formed expressions with no defined meaning in terms of machine instructions. My claim is that this is a reduction in precision compared to assembly language.

    Grandparent said:

    > The single best feature of any programming language is that it is precise.

    C overtook a more precise language family because it has features other than precision that people cared about. Perhaps a better tradeoff of expressiveness and readability with precision.

    Grandparent could be correct, and precision is the best feature of C, despite being less precise than ASM. And its better expressiveness nets out to a better overall programmer experience. I just wanted to point out that precision is something we do trade away for other things we want.

    • I don't completely follow the analogy, but I do follow the argument. High precision regarding the requirements often is not needed and that's exactly where LLMs shine.

      That's also where engineers come into play. They (and often only they) can judge how much precision is needed depending on the part of the system they are working on.

    • Could you please explain why you feel that having UB makes C less precise than asm?

      To me, the notion of precision isn't in any way related to whether any given statement is sound. It's about the behavior of the language for sound programs.

      4 replies →