← Back to context

Comment by thaumasiotes

4 months ago

> this is a very stupid thing to say

Well, it does have the virtue of being straightforwardly true. For example, programming languages can't be ambiguous.

> programming languages can't be ambiguous

This is "straightforwardly" false.

Speaking specifically about the "language" part - while there is a formal specification for C++, many pieces are implementation dependent. Then there is actual undefined behavior that is part of a specification.

Actual programs implemented in a language can be ambiguous. consider multi-threaded programs where data arrive at different times in different threads, leading to different outcomes. Or just pure ambiguity of intent. Or a program which incorporates undefined behavior intentionally.

Formal and natural languages may overlap in some ways but it is ridiculous to compare them in this way and claim a probabilistic model is better at the formal language. Translation tasks are an example where LLMs perform extremely well, I would argue much better than in programming. Should I make the claim it's because of some intrinsic attribute of natural language vs formal language?

> programming languages can't be ambiguous

Yes, in C++ we call it "unspecified behavior" and "undefined behavior"

  • Those occur when you've made an unambiguous statement that has no valid semantics. ("God should get a promotion."†) They don't occur when you've made an ambiguous statement ("We saw her duck.") As I noted above, it isn't possible to make an ambiguous statement.

    † I'm aware that that isn't an unambiguous statement. This is for the simple reason that it's next to impossible to make an unambiguous statement in a natural language; that's why legal documents use so many clauses. I'm relying on the reader here to realize which meaning I had in mind, which is the way all natural language works.

    • The case "God should get a promotion" if I understand correctly, is soundness (as in Rust) issue, with equivalent in C: `int increment(int x) { x + 1; }` - sound, not valid.

      The case with legal documents is equivalent in C sequence points for comma operator with something like `print(i++, i++)`. Imagine Boeing documentation with text "In case of blinking indicator press button A and stop immediately". Button "A and stop"? Button "stop" after button A? Authors can hope that a sane human can resolve this ambiguity, but if it is done by compiler/interpreter/robot, it can have an avalanche effect.