6 ms·
There are so many times the Oxford comma prevents ambiguity. I have yet to see a counterexample. Commas separate list entries, don't change it for the last one.
by EuanReid 6mo ago
There are so many times the Oxford comma prevents ambiguity. I have yet to see a counterexample. Commas separate list entries, don't change it for the last one.
- t0mek 6mo agoOnly tangentially related (but hey, it's HN) - I'm so happy about the support/requirements for trailing commas in the modern language syntax: x = [ 123, 456, 789, ]; It makes editing such a list so much easier. Also, the commit diffs are cleaner (you don't need to add comma to the last element when appending a new one).
- Izkata 6mo agoMy very first programming language doesn't use commas: x: [ 123 456 789 ]
- echohack5 6mo agoThe oxford comma debate is so annoying because it clearly has nothing but advantages. Removing commas from a delimited list does nothing to resolve ambiguity, whether lexicographically or syntactically. It's so useful as a delimiter and anti-ambiguity machine, that you don't even need spaces for it to work! See CSV or Japanese.
- mmooss 6mo ago> The oxford comma debate is so annoying because it clearly has nothing but advantages. .. if you care only about data communication and have no sense of beauty, aesthetics, rhythm or personality in writing.
- black_knight 6mo agoI like this: x = [ 123 , 456 , 789 ]
- tommy_axle 6mo agoNah, prepending will lead to a messier diff than the parent example.
- deleted 6mo ago[deleted]
- stephencanon 6mo ago"I'd like to thank my mother, Ayn Rand, and God" is the usual example. Yes, you can reorder the list to remove the ambiguity, but sometimes the order of the list matters. The serial comma should be used when necessary to remove ambiguity, and not used when it introduces ambiguity. Rewrite the sentence when necessary. Worth noting that this is the Oxford University Press's own style rule!
- alistairSH 6mo agoI always heard this one... We invited the strippers, JFK, and Stalin to the party. [three groups invited - strippers, a president, and a premier] We invited the strippers, JFK and Stalin to the party. [the president and premier are strippers] Very different visual conjured by those two sentences.
- PaulDavisThe1st 6mo agoI'd prefer: We invited the strippers, JFK and Stalin, to the party [two strippers, named JFK and Stalin] if the goal is to minimize ambiguity.
- al_borland 6mo agoI can see it being tiresome to read text where the author is continuously interjecting clarification with brackets.
- PaulDavisThe1st 6mo agoThe square-bracket clarifications here are meta-text designed to absolutely clarify the intended reading of the preceding text, so that the reader can contrast their understanding with the intended one. There is no suggestion that one would do this in "regular" text.
- comprev 6mo ago"John helped his uncle, Jack off a horse" "John helped his uncle Jack off a horse" Two very different outcomes...
- n4r9 6mo agoWikipedia has an interesting example where it's still ambiguous: They went to Oregon with Betty, a maid, and a cook. It's not clear whether Betty is the maid. But tbh removing the comma doesn't help either. Personally if I wanted to indicate that Betty was the maid I would put "a maid" between brackets or hyphens.
- dheera 6mo agoThis sounds like a case where we should just change the syntax. If Betty is the maid it should be written: They went to Oregon with Betty [a maid], and a cook.
- dullcrisp 6mo ago(They (went (to Oregon) (with ((Betty (a maid)) and (a cook))))). ((That (is (the (most natural) syntax))) and ((all (of us)) (should (switch (to it))))).
- thom 6mo agoMany years ago working on natural language to SQL, when we had ambiguities this is how we’d clarify things with the user (albeit with the minimal amount of brackets necessary).
- readthenotes1 6mo agoIt looks like you might have learned how to diagram a sentence as a youth
- yellowapple 6mo agoIt seems you're speaking with a Lisp :P
- 1659447091 6mo agoThis is how I was taught. Use ( ) or -- -- here and the Oxford comma for list of 3 or more. I get lazy with adding the comma before the "and" in list, and without fail I hear my grandmother/father/teachers pointing out how wrong I am for doing so. Same for my use of semicolons followed by "and" or "but". I never realized the Oxford comma was even something up for debate.
- ajdude 6mo agoMy heroes are my parents, Superman and Wonder Woman!
- rationalist 6mo agoIf Superman and Wonder Woman were the parents, wouldn't a dash or colon be more appropriate than a comma?
- bennettnate5 6mo agoIt's common in English writing to interject additional details in on a noun by using a phrase separated with commas. I've personally found Oxford commas can in certain cases make it unclear whether you're interjecting or not, like so: Alice, the cook of the house and the guest were very chatty that evening. Alice, the cook of the house, and the guest were very chatty that evening. In the second, is Alice the cook of the house or not? This is the ambiguity of Oxford commas.
- function_seven 6mo agoIf you’re one to omit the Oxford comma in your writing, then how do I resolve the ambiguity in your first example?
- tzs 6mo ago> There are so many times the Oxford comma prevents ambiguity. I have yet to see a counterexample. In every counterexample that I have seen the ambiguity involves an appositive phrase set off by commas which is lurking nearby in the sentence. Commas are the most common way to set off an appositive phrases but most sources say that em dashes and parenthesis are also acceptable. This means you can use a simple rule and not have to worry about ambiguous lists: (1) always use the Oxford comma, and (2) if you need to set off an appositive phrase for an item in the list set it off with em dashes or parenthesis.