I think that the code-translation tag could need a clean up.
The current tag wiki excerpt reads:
For questions regarding the translation of code from one programming language to another. NOTE that asking to have your code translated is not suitable for Stack Overflow.
At first this looks like the two sentences contradict each other. I think this could use a rewording.
In my opinion we can group code-translation questions into three categories
- Questions talking about the conversion of a simple functionality of language A to language B are on-topic.
- Questions asking to convert a whole program from one language to another are off-topic.
- Questions asking about a converter to translate a program from one language to another are also off-topic
There is a fine line between 1 and 2. When do we talk about a simple functionality (1) and when about a whole program (2)?
Questions falling into the first category are fine and can be left as they are. For the second category I suggest the following steps:
- Remove the code-translation tag
- Close the question as: Needs more focus.
- If the question can be deleted by the roomba (i.e. it has a negative score and no answer), leave it closed. If not vote, to delete.
For the third category the steps are the same as with 2), but the question should be closed with the: Seeking recommendations for books, tools, software libraries, and more reason.
For the record: there are currently 374 questions in total, a subset of 46 have a negative score, and of those 14 are already closed.
replace
in JavaScript replaces the first instance of a match on the first argument with the second. Other languages replace all instances. A question asking how to replace strings in one of these other languages might miss out on JavaScript's fun interpretation, leading to bugs as the OP blithely thinks they are the same. Now, that could be considered the OP's fault for not reading TFM, but...replace()
function replaces all instances and that if they want to translate a javascript question, they will be blown away by the difference. Now in more seriousness, that last thing is a non-issue since you have to describe what the source language does anyways.replace
function? That's why a translation part is important, because an expert in the original language will know the nuances of those gotchas, whereas an expert in the new language may not. Leaving out the translation places a larger burden on the OP to do the research and understand the original language. I haven't seen that kind of research in a question in long time.