If I were asked the question "You won't go to the party, right?", would it be incorrect to say "Yes, I won't go"? If one had to choose between "yes" and "no, would it be more grammatically correct to answer literally and say "Yes" or to address the concept of not going and say "No"?
A simple "yes" or "no" answer would be highly ambiguous. Since you're adding "I won't go," though, it's clear what you mean. Between "Yes, I won't go," and "No, I won't go," the latter is more common. (The concept of grammatical correctness doesn't apply well here because it's an unusual case, not something we have a broad, universally accepted rule for. The best you can do is say something that sounds normal and makes your meaning clear.) Here are a few unambiguous answers you could give:
- I won't go.
- That's correct; I'm not going.
(This was supposed to be a comment, but it grew too long in the telling.)
This confusion about how to answer negative questions sometimes perplexes not just non-native learners of English, but native speakers as well, particularly those of a particular bent and background.
In The Jargon File, Eric Raymond writes:
Hackish speech generally features extremely precise diction, careful word choice, a relatively large working vocabulary, and relatively little use of contractions or street slang. Dry humor, irony, puns, and a mildly flippant attitude are highly valued — but an underlying seriousness and intelligence are essential. One should use just enough jargon to communicate precisely and identify oneself as a member of the culture; overuse of jargon or a breathless, excessively gung-ho attitude is considered tacky and the mark of a loser.
This speech style is a variety of the precisionist English normally spoken by scientists, design engineers, and academics in technical fields. In contrast with the methods of jargon construction, it is fairly constant throughout hackerdom.
It has been observed that many hackers are confused by negative questions — or, at least, that the people to whom they are talking are often confused by the sense of their answers. The problem is that they have done so much programming that distinguishes between
if (going) ...
if (!going) ...
that when they parse the question “Aren't you going?” it may seem to be asking the opposite question from “Are you going?”, and so to merit an answer in the opposite sense. This confuses English-speaking non-hackers because they were taught to answer as though the negative part weren‘t there. In some other languages (including Russian, Chinese, and Japanese) the hackish interpretation is standard and the problem wouldn't arise. Hackers often find themselves wishing for a word like French si, German doch, or Dutch jawel — a word with which one could unambiguously answer “yes” to a negative question. (See also mu)
The bottom line is this:
You cannot unambiguously answer a negative question in English with either of just plain “Yes” ore just plain “No”.
Non-programmers sometimes give native questions a response as though the question had been asked in the affirmative not the negative, while programmers sometimes give a response which is the logical negation of what the non-programmers give, which is what leads to misunderstandings between programmers and muggles and why ESR mentioned it.
This is not a matter of grammar, but of logic and vocabulary or lack thereof.
When faced with a negative yes/no question like “Aren’t you going?”, we cannot in English do what French does, where positive questions get the oui/non pair but positive questions get the si/non pair. I’ll use 0 and 1 to indicate the boolean truth of the response to the boolean question:
Est-ce qu’on y va? (positive question)
1: Oui, on y va. (agreement with question)
0: Non, on n’y va pas. (disagreement with question)
while negative questions get the si/non pair:
Est-ce qu’on non y va pas? (negative question)
0: Si, on y va. (disagreement with question)
1: Non, on n’y va pas. (agreement with question)
(And good luck hearing the difference between “on y” and “on n’y” in connected speech: there is good reason that auxiliary indicators are required for clarity in speech!)
When the same non (meaning “not” in English) might be agreement (answer=1) or disagreement (answer=0), there is obviously a serious problem. French dodges the problem by having oui for agreeing with a positive question and si for disagreeing with a negative question. English has no such possibility, and you are advised never to rely on either interpretation.
This has all been well-covered elsewhere: don’t answer negative questions with yes or no unless you intend confusion.