When does a comma change the meaning of a sentence?
Match the two sentences with their meaning:
1) I had a discussion with a friend and a programmer.
2) I had a discussion with a friend, and a programmer.
Meanings:
a) I talked to a friend who is a programmer.
b) I talked to two people, a friend, and a programmer.
Intuitively, I know that 1 => a, and 2 => b. Is there a rule? Does this grammatical construct have a formal name or definition?
"I had a discussion with a friend and a programmer" does not mean "I talked to a friend who is a programmer". Both 1) and 2) have the same meaning b). However, the use of comma before and is now discouraged by some and flagged by some software.
For the first meaning, you would say "I had a discussion with my friend, a programmer" or better still, "I had a discussion with a programmer friend".
There should not be a comma before and in any case as there are only two items.
I had a discussion with a friend and a programmer
could mean either you had a discussion with two people or only one who is both a friend and a programmer, but in the absence of further context, it is usually taken to mean the former.
For example, it would be clear and correct if you had written
I had a discussion with a friend and a programmer. His name is Darren.
This would mean that you had a discussion with Darren who is both your friend and a programmer.
1) I had a discussion with a friend and a programmer. - This could be one or two people.
2) I had a discussion with a friend, and a programmer. - This sentence is wrong. The comma is incorrect there, whether this describes one or two people.
a) I talked to a friend who is a programmer. - This is only one person.
b) I talked to two people, a friend, and a programmer. - This is not two people. This indicates FOUR people! (two people, plus a friend, plus a programmer)
Regarding B: If you want two people here, use "I talked to two people: a friend and a programmer." "A friend and a programmer" will be a non-restrictive appositive for "two people."
If you want one person and no ambiguity, you could write "I talked to my friend, a programmer" or "I talked to my friend, who is a programmer," or "I talked to a programmer, who is a friend." Other options are possible.
None of these is a case of the serial comma creating confusion. For example of that, see "A Serial Comma Creates Confusion" - http://zencomma.wordpress.com/2011/09/20/a-serial-comma-creates-confusion/
This could be considered as an example of ambiguity introduced by an Oxford comma.