30

I just came across a question that has been deleted now because apparently I left a snarky comment.

The question provided a code snippet in JavaScript with the following syntax (the code is not exactly as in the question since I can no longer view it).

let myDiv = document.getElementById("some-div");
myDiv.addEventListener("click", function() {
  alert("some div"), true;
});

The OP mentioned setting the capture flag to true which I noticed wasn't correct because I saw a syntax error in the script.

Now I don't know if that syntax error is the cause of the OP's issues so instead of leaving a detailed answer, I simply left a comment in hopes that the OP can correct the syntax and maybe even fix the problem. All I said was:

You didn't set {capture: true}. Your syntax is incorrect.

Another user commented after that saying that a Boolean third parameter to addEventListener is equivalent to setting the capture flag.

Now this other user has waaaaaaaay more points than I do and I am not a JavaScript expert so I thought maybe you can set it that way and maybe this other user is correct, but I responded anyway trying to have a nice discussion.

I then commented back saying:

That doesn't look like a third parameter to addEventListener to me.

To which this other user acknowledges the error in the syntax. Okay good, I'm not going crazy. But at the same time this other user acknowledged the syntax error, he also said that I shouldn't just say "You have a syntax error" but instead to provide more details.

I was about to write a response to say that I only wanted to point out a syntax error but not really provide an answer because I didn't really know if the syntax error is the cause of the issue. I just wanted the OP to look into it. When I said "You didn't set {capture: true}" I identified an issue, and by saying "Your syntax is incorrect" I hinted at where the OP might possibly look at to fix it. But before I could finish writing my response, the OP responded saying something like the reason why people don't like asking questions is because people like me leave snarky comments. And the OP then proceeded to delete the question.


In retrospect, maybe the "That doesn't look like a third parameter to addEventListener to me" could've been phrased better but I don't know. I thought I tried to help but I guess I did it wrong?

8
  • 43
    Your comment as described seems fine to me, a bit terse, but not rude or overly snarky. I'd just move on and forget about it. Commented Apr 12, 2022 at 21:22
  • 2
    There is no syntax errors in the code you've shown (function f(){1,3} is perfectly ok), also it is possible you mis-remember the exact code... Providing more specific comments is generally safer and more actionable. (Also note that most people posting such questions don't know what "syntax" or "syntax error" is, so "you have syntax error" is at least useless for them) Commented Apr 12, 2022 at 21:46
  • 6
    @AlexeiLevenkov Note that the first comment does not say "syntax error", it says "syntax is incorrect". That doesn't necessarily mean there's an error, it was likely meant to mean that the syntax as written will not do what they want. So what they've said isn't strictly speaking wrong. Commented Apr 12, 2022 at 21:53
  • 11
    Your comment is fine. The syntax used by the OP to provide a third parameter is indeed incorrect. It could have been phrased better, sure, but hindsight is always clearer. Closing the question as a typo was the right thing to do. We don't need Q&As for every incorrect place a comma can fall in JavaScript. Commented Apr 13, 2022 at 0:21
  • 10
    Some users just want an answer spoon fed to them, and anything other than that is unproductive. Some users are good at playing "The Victim". Disengage and move on, it's not worth your time and aggravation.
    – Drew Reese
    Commented Apr 13, 2022 at 1:01
  • 1
    I find that answered typo questions get a ton of down votes in while the answers (and these often get duplicate answers once the first answer gets upvoted) get lots of up votes. Letting them know about the syntax issue was actually doing them a favor in the long run if they want to avoid a question ban.
    – BSMP
    Commented Apr 13, 2022 at 18:07
  • 1
    I think it is certainly okay to simply point people in the right direction. But since we are all humans, and we don't know much about the other person, I think a good rule of thumb is to try to be nice and encouraging besides being factual.
    – Fom
    Commented Apr 15, 2022 at 9:41
  • 2
    The question was more likely deleted because the OP realized it would end up closed and/or get downvotes due to just being a simple typo. Their response was probably hostile because they were embarrassed they had made a mistake and posted it publicly rather than you actually being snarky.
    – Herohtar
    Commented Apr 15, 2022 at 15:06

4 Answers 4

49

Honestly, if a user thinks that being advised they have a typographical error is "snarky" then they likely aren't on Stack Overflow for the right reasons; they aren't there to ask high quality, well researched questions, they are there to get "quick answers" to problems they haven't tried to solve themselves. A typographical error is often something that will easily be found with a little bit of debugging, and most certainly would be if an MRE is attempted to be created.

If they want to delete their question, then that's fine; it'll contribute to a question ban as the question was no doubt poorly received (or at least not upvoted) and if they do that too often they'll find asking questions in the future harder. That's a win for the users here, as it means that that's one less user who will contribute low quality questions.

Most likely the question would have been deleted anyway (due to no upvotes and being closed), so the OP deleting the question has just expedited the process. Simply move on, and look forward to answering a higher quality question. You did nothing wrong by pointing out the OP's error.

2
  • I honestly didn't realise me deleting my own question would contribute to a question ban. Occasionally I ask a question that, while being a reasonable question, turns out to be one that's utterly useless to other people because it's an issue that was caused by some legacy field in the database I never knew was referenced (for example) Commented Apr 14, 2022 at 15:27
  • 2
    Yes, though not officially confirmed, it has certainly been often hinted that zero score deleted questions weigh more heavily against a question ban than undeleted zero score questions, @AndrewCorrigan . (It has been confirmed that deleted zero score questions do contribute.)
    – Thom A
    Commented Apr 14, 2022 at 15:30
1

Is it wrong to leave a comment to point the OP to the right direction instead of a detailed answer for simple syntax errors?

It's always preferred to leave a detailed answer to any ontopic question instead of answering the question in comments, if you can answer it. Comments are primarily for clarifications. Answers should be in answers to allow quality control on them. Pointing someone in the right direction, only if you yourself do not know the exact answer, is acceptable but should be formulated in the right way.

The rest is just corollaries of this:

  • The question might not be ontopic, it might be a simple typo unlikely to help others. In that case vote to close and sure, why not, mention the typo in a comment.
  • You might be wrong. You might be convinced that there was a syntax error but there wasn't one (because maybe a third parameter is equivalent to something else and miraculously it works nevertheless or so). If you would have written that there was a SyntaxError but there wasn't really one and you would have written that in an answer, as you should, it would have been downvoted, as it should, and all would be well.
  • You weren't sure and wanted to really ask for clarification. In that case your comment was overly confident, it should have been something along the lines of "It seems to do not set capture to true in your code. Is your syntax correct?" Commenting was fine in that case, but it should have been phrased differently (preferably as a question).
3
  • 1
    I feel like this is the sentiment I wanted to convey, but did so a little too laconicly.
    – Makoto
    Commented Apr 15, 2022 at 20:14
  • Questions stemming from syntax errors alone tend to be closed as ‘caused by a typo’, though.
    – dumbass
    Commented Apr 16, 2022 at 11:51
  • @user3840170 Yes, didn't I mention that? The keywords are "solved in a manner unlikely to help others". I think I discussed it. Commented Apr 16, 2022 at 20:56
0

As a relatively new user, and someone new to programming and writing code, I don't have much to say in terms of whether or not your statements were correct, but I can offer insight into how folks might interpret your comments.

Short answers, or answers pointing out errors without explanation, elaboration, or further direction of any kind, are not generally helpful for the receiver. It is unlikely that the person will leave with any increased understanding that would prevent future errors, or any motivation to act in the way you wish they would - if they even understand what you meant in the first place. It is easy to misinterpret brief communication because little to no information or context about the sender's intent is provided - leaving room for the receiver to fill in any blank imaginable.

For example, logical or not, many humans care to some degree about their self-esteem. A message from someone faceless on the internet telling a person they made a mistake may be interpreted by that person as an insult. Or they might make even greater leaps in judgment - they may decide, incorrectly (or otherwise), that the sender is arrogant, or at least insensitive to their plight. They might be more forgiving sometimes of course. Or they might see no intent when it is in fact there - maybe the sender meant to insult someone, and the receiver overlooked it!

Speaking for me personally, if I post a question here, it's because I'm stumped, have already spent time scouring the internet with no results yet, and I recognize I'm not able to get much farther without additional outside information. I came to this community in search of support and assistance. If the general attitude of this site were to tell everyone asking questions to go figure it out themselves, it would defeat the purpose. Sometimes, the appropriate response may simply be a helpful pointer to an existing answer or a helpful explanation of how to better craft a question. But with so many different users of different skill levels and background posting here, and many being unfamiliar with the site or its unwritten rules, it can be difficult to write a question, comment, or answer that will be received well by all. Just be patient with yourself and other people and everything will be fine. (But don't break your own back in the process, obviously, it's just a message board at the end of the day)

1
  • 3
    Problem is that those with the knowledge probably do not have much time for long and detailed explanations. If you just look at the stats you see that SO is failing its knowledge seekers year over year. Millions of questions have literally got no response at all. Sometimes a short sentence is all one can get or nothing. What would you prefer under these circumstances? A very, short hint or no feedback at all? I'm all for being polite though, but the resources here are definitely quite limited. Commented Apr 15, 2022 at 20:49
-43

Please stop answering questions in comments. It makes it damn hard to keep track of what is and isn't actually an answer to someone's question.

To clarify or refine my position:

  • Question closure indicates that there is a fundamental problem with the question (topicality, relevance, usefulness, etc), and it may be ideally resolved through edits.
  • Answering a question indicates that there is no fundamental problem with the question, and the answers can benefit others in the future.

There is already prior art on using comments as answers - it's expressly discouraged. There should be no reason to work around this.

To misuse the system to answer questions that should be closed is a gross oversight of how the site is meant to work at all.

21
  • 44
    If you're going to close the question as a typo, shouldn't you "answer the question in a comment"? Commented Apr 13, 2022 at 0:15
  • 3
    @HereticMonkey You could and I also do that sometimes, but I don't think it does us any good. It just teaches the user that no matter what they ask someone will answer, even if it is only in a comment. They got what they want and keep asking such questions. So we're sending the wrong signal.
    – Tom
    Commented Apr 13, 2022 at 0:25
  • 6
    @Tom If they keep asking such questions, they'll soon run into a question ban, no? If one asks questions and they're all getting closed, that's a pretty strong signal. Commented Apr 13, 2022 at 0:31
  • 4
    It's easy to tell what's an answer; it's the thing typed into an answer box. They come after the "X Answer(s)" header. Couldn't be any clearer. If it's a comment, and the question isn't closed (or on its way), it's fair game for copying to an answer. Commented Apr 13, 2022 at 0:35
  • 2
    @HereticMonkey A question ban is an issue for someone who cares about their account. Anybody else just creates a new one. When they won't get any help/answers on the other hand also shows those users that their approach isn't successful.
    – Tom
    Commented Apr 13, 2022 at 0:42
  • 12
    Instead of answering typo question in comment, if I post full answer, there is possibility that someone will upvote it. That way, even if question is closed afterwards, it does not roomba. Waste of 3 precious delete votes and good chunk of time of at least 3 contributors.
    – Amit Joshi
    Commented Apr 13, 2022 at 10:04
  • 23
    Apart from that typo questions are supposed to be closed, @AmitJoshi , as they aren't going to be using to future readers. An answer that states "You wrote cleint instead of client" or "You forgot to put a comma after the alias Potato." Isn't going to be useful to anyone but the OP. Typographical questions like that almost certainly mean that the Op didn't spend enough time debugging, or taking 5 minutes to review their code; if they actually put in the effort to make a MRE they'd have found it. Closing and a comment is by far the right choice here; then the question can be deleted.
    – Thom A
    Commented Apr 13, 2022 at 10:58
  • @HereticMonkey: No. If I'm going to close the question, I'm going to close the question. Closure and answering are mutually exclusive functions of the site, and shouldn't be worked around with comments.
    – Makoto
    Commented Apr 13, 2022 at 14:46
  • 6
    Does “you have a syntax typo” count as a real answer without explaining where it is or how to fix it? OP didn’t even know if fixing it would solve the problem.
    – BSMP
    Commented Apr 13, 2022 at 17:58
  • 12
    @Makoto This runs counter to the utilitarian view that most other users seem to have, which is to do the least amount of harm and most amount of good. Closing a typo question and explaining the issue in a comment both helps OP by solving their problem (does good) and helps the site by closing a typo question (does good). If you think commenting shouldn't be done, OK, you're still closing the typo question, but you're not helping OP as much. Sure, they might be able to figure it out from the close banner, but they might not.
    – TylerH
    Commented Apr 14, 2022 at 15:07
  • 10
    In short, commenting with the issue is better than not commenting because it does more good and doesn't do any harm.
    – TylerH
    Commented Apr 14, 2022 at 15:08
  • @TylerH: So maybe we should revisit this close reason at all. If we're not closing every typo question unilaterally (including no answering in comments), then there are unspoken rules about which typo questions are okay to half-answer and which ones are not. That is an unacceptable circumstance since it means that people are always going to be getting a mixed signal on this.
    – Makoto
    Commented Apr 14, 2022 at 18:30
  • 2
    Sure, however, we are dealing with humans, not some sorting game. Closing without pointing out the obvious typo only gets rid of the question, it doesn't solve the problem and is likely to result in further wasted time by both the op and the users who will have to deal with the repeat question. There is no learning opportunity when dealing with real typos.
    – Kevin B
    Commented Apr 14, 2022 at 19:58
  • 3
    Highlighting a typo in a comment is not an answer though, it's a way to ask for clarification even if not formulated as a question. Only the asker can confirm if it fixes the issue or if it was just an unrelated copy/paste error when drafting the question. If it happens to fix the issue, then it's fair game to close as a typo. Commented Apr 14, 2022 at 20:00
  • 3
    @paxdiablo english.stackexchange.com/questions/132868/…
    – Daedalus
    Commented Apr 15, 2022 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .