5

Prerequisites

  • I know there are lots of questions and duplicates that explain that comments won't support code blocks and full-functional formatting.
  • It is also declared that comments are used as a thing to clarify/improve the question.

Typical use-case

  • The question contains not a full code fragment.
  • I try to reproduce it, write my own code.
  • The problem does not reproduce yet, I've got different results in my code.
  • I want to show what I've written to OP to let him compare his code with mine.
  • I need to have code formatting (and other formatting, like headers, lists etc).
  • Obviously this is not yet an answer, this is a step in question clarification process. For this purpose, the comments exist.
  • If I will post it as an answer, it will be fairly flagged as "Not an answer".

The question is

What is the correct behaviour in this case?

  • Still post a formatted code as an answer?
    • Any additional advices how to mark it as "not yet an answer"?
  • Post code to some outer place (GitHub etc) and post a link to it in a comment?
    • I don't like it too much since it will force the readers to switch between SO and other site.
  • Contact the OP out of the answer discussion and ask him to post my options into the question.
    • There are unfortunately no direct messages on SO, and there is a logical "keep all discussions accessible for everyone" reason.
  • Something else?
3
  • 3
    If you're replying with code that isn't an answer, you have a comment. If you're using answers to bypass the comment length limit, that should be deleted. Related: meta.stackoverflow.com/q/269993/6296561
    – Zoe Mod
    Jun 27, 2019 at 21:49
  • 1
    Note that while there is no DM, there is chat. I'm not sure the formatting available there is any better than comments though. I do wonder about the need for "other formatting, like headers, lists, etc." if it's just for clarification.... If the clarification is that involved, it sounds like the OP may be in need of more fundamental help than is available on SO. Jun 27, 2019 at 21:52
  • 21
    "The problem does not reproduce yet" ... stop there and flag the question as either unclear or better "a problem cannot be reproduced" (in the "off-topic" section). And then I would suggest to move on, since when OP couldn't be bothered with creating a [mcve], then you shouldn't be bothered with spending your worthful time there.
    – Tom
    Jun 27, 2019 at 21:55

1 Answer 1

20

Minimal bar - vote to close post as "unclear" or "missing code" and move on. Do not post clarifications to the question as an answer under any conditions - answer posts are for answers to the question.

If you think you know what OP is asking and want to help - comments, links to off-site code editors and collaborations sites (including https://jsfiddle.net/, https://ideone.com) in comments, chat are all good ways to communicate with OP on complete example.

If you have solid demonstration of the problem user have you may consider editing it into the question - this would be very controversial edit and asking new question yourself with that code may be a better option. I would edit my code into original post only if I know that question is of high value and may get downvoted/deleted as result of missing MRE.

Above suggestions are for helping to add MRE to the question. If you have partial code that answers the question - it is ok to post it as an answer. You need to clearly explain why you believe that given code is good starting point and how OP should proceed to get complete solution in addition to stating that it is not complete solution. Definitely do not post just chunk of code that does not solve the problem without additional guidance - it will collect downvotes as "not useful".

4
  • "I would edit my code into original post only if I know that question is of high value and may get downvoted/deleted as result of missing MRE." That sounds like all the more reason to post your own version as a new question, instead of editing it into another question. That someone else asked a bad question is not grounds for you to basically just replace it with an entirely new question. If you think you've found a good question that's simply inspired by someone else's question, ask it as a new question. Possibly linking back if you think that has value.
    – Servy
    Jun 28, 2019 at 13:29
  • @Servy Replacing a not-MCVE with an actual MCVE that represents the question posed seems like a fair use of the edit feature. Do we really need a duplicate question for that? And if adding an MCVE "basically just replaces it with an entirely new question" then, well, you must have been doing much more than just adding an MCVE. Jun 29, 2019 at 20:24
  • 3
    @LightnessRacesinOrbit But how do you know that code really represents the problem of the OP. Such an edit may in fact demonstrate a different problem than the one the OP has. Jun 30, 2019 at 6:51
  • @MarkRotteveel In all this I'm supposing that, either through comments or because it was somehow entirely obvious, we do know that the code represents the problem the OP has (that's my "that represents the question posed"). You're absolutely right to suggest that if there's any doubt then the edit is, at best, premature. I will say that, at least in c++, it's usually possible to make an MCVE for editorial reasons only because the actual problem being asked is obvious, just badly-presented. Jun 30, 2019 at 12:58

You must log in to answer this question.

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