Advice without knowledge of specific language

I'm here for a little more than one year now but still very new to the how-to of the place, and a recent comment in this post made me think that maybe I was overstepping my boundaries.

I'm not well versed in that many languages but I have lot of experience programming (I'm a senior dev) and algorithm being what it is; I always answered questions in a specific language with general programming advice by taking the time to check if this and that function existed, how they worked and if the advice could apply, but not the entire "best practice recommendation" (I may if it's a new job but not just for an answer in this forum, no offense intended ^^).

I thought that by just signalling it honestly as a proof of concept (like I did in the answer above and in this one) OP and the community could correct me in case I missed some obvious specificity of the language (well in the hangman \\ case it's more of an oversight on my part really ^^") and that it was still better than no advice at all.

Is this true? Do I instead need to stay away from question using language I don't master? Do you prefer potentially improvable answers who may be and stay "wrong" if nobody double-checks them or no answer at all?

• I wrote an answer about a Ruby question – which I had never used before. What I did though is to run the suggested code to make sure that there are no obvious errors. – Martin R Aug 27 '19 at 15:21
• @MartinR : then do you suggest to always run suggested code ? It suppose to always write full runnable code wich may be more or less simple depending on the situation (and language) but I think I could do that. Could you flesh out your comment in an answer ? – Nomis Aug 27 '19 at 15:40
• It's not always possible to run suggested code, specially when third party libraries are involved it can become tricky at times. If you can't run it, you could always try to get it verified to some extend using an online editor, compiler, linter, beautifier. – dfhwze Aug 27 '19 at 20:36

I personally have a bit of a history with writing reviews for languages I don't know squat about. Some of these reviews got comments like yours, where people pointed out syntax errors to me (and referred me to styling guidelines). Sometimes I even get a comment that makes parts of my review outright wrong or obsolete (e.g. here).

That is not the end of the world, though and doesn't mean I'll stop reviewing code in languages I'm not intimately familiar with.

Reviews are allowed to touch on any and all aspects of the code, and let's be honest: for most suggestions, you do not need to be an expert in the language. It just takes being an intermediate programmer to spot and correct algorithmic issues in most languages.

Learning languages is something that I currently mostly do by writing reviews, even when I'm not sure I could write code. This works because it's easier to modify existing code as opposed to writing new code from scratch.
Overall I think this site is better for allowing people of all expertise levels to write reviews. Of course that does not exempt you from getting your review examined by people who actually know what they are talking about ;)

I guess what I'm trying to say is:

A slightly wrong (and subsequently fixed) answer is better than no answer at all.

• 100% this. Even in the only tag I contribute I answer stuff I have no clue about. Even to this day people point out how I've messed up. – Peilonrayz Aug 27 '19 at 10:18

Our How do I write a good answer? guidelines state that

Every answer must make at least one insightful observation about the code in the question.

but also that

We don't expect every answer to be perfect, but answers with correct spelling, punctuation, and grammar are easier to read and tend to get upvoted more frequently. Remember, you can always go back at any time and edit your answer to improve it.

So if your answer makes an insightful observation then it is a useful answer, even if there are small errors. Respond to the comments and fix the code, if necessary.

What I recommend is to run the suggested code before posting it. I definitely do that with languages in which I am not so experienced, but usually also with languages that I am quite confident with. That helps to avoid syntax errors and obvious logic errors. With that precaution I was able to post even an answer in a language that I had never used before.