7
\$\begingroup\$

I understand the policy that we do not allow pseudocode in the question. That said, if an OP indicates it, would answers whose language diverges from the language of the post be on-topic?

The motivating example is How to optimize bitwise get/set/clear of ranges of bits? . The original language is JavaScript. I ended up tagging the question as JavaScript due to the lack of a language tag, but the OP indicates that suggestions in any language would be acceptable; in turn implying that the most important thing he wants reviewed is the algorithm and not the JS-specific implementation.

\$\endgroup\$

2 Answers 2

7
\$\begingroup\$

For a question to be on-topic it must have a compiler, interpreter or travel through a series of transpilers until we get something we can run. For example JSX + TypeScript -> JavaScript is fine. Whilst the OP would more than happily post pseudocode, we won't allow it.

Since it's not pseudocode we can happily forget about this rule, as thinking about it will only be confusing and not constructive.


if an OP indicates it, would answers whose language diverges from the language of the post be on-topic?

OP indicates that suggestions in any language would be acceptable; in turn implying that the most important thing he wants reviewed is the algorithm and not the JS-specific implementation.

I see no reason to disallow this.

  • The only restriction we put in place for answerers in this regard is that they must provide an explanation of their answer in English. Whether the answerer wants to include code in any other language is up to them.

  • Some users may downvote answers with code in a different language than the OP's code. This is because it can be confusing for the OP. But this isn't the case if the OP explicitly asks for this.

  • What benefit does closing a question that says "answerers, I'm happy for anyone with skill in any language to answer using your preferred language" bring? That's just making life more difficult for askers and answerers.

\$\endgroup\$
4
\$\begingroup\$

Your question isn't entirely clear, but I'll try to answer it since I suspect what you're really looking for is a combination of the following.

Pseudocode is off-topic. There's multiple reasons for this, but one of them is that the code has to be actual code, from a project or anything, that's actually used or has been used. In this case, the code presented is not pseudocode. So there's no problem on that front.

The question of the OP contains the following:

Wondering if one could rewrite these 4 functions to make them more optimal.
...
I don't think JavaScript is a requirement for the answer, C or other similar languages would work.

The code presented is up for review, the goal is to optimize the functions provided and how that's actually achieved by the answers is left open. Answers in other languages are explicitly allowed by OP. That's fine, but OP doesn't decide what is and isn't an acceptable answer on Code Review.

Answers containing pseudocode have always been acceptable, as long as they're part of a review. Not on their own though. After all, we are not Stack Overflow, where answers along the lines of "Try this: <code snippet>" appear to be acceptable.

Answers containing code in a different language are ordinarily frowned upon because they may not be of much value to whoever posted the code. We've talked about this.

Having some experience in both languages, I don't see how C answers are going to be relevant to JavaScript question except on a very low level. Considering OP's action here is simply more confusing than helpful, I've removed the problematic line.

\$\endgroup\$

You must log in to answer this question.

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