15

There are a lot of (perfectly valid) questions of the form

Does Language X have a feature similar to Z in Language Y?

Sometimes these questions include the tag for Language X only, but sometimes they include Language Y's tag as well. Is there a consensus on whether or not both tags should be included? And if so, is it worth editing the questions to make them follow this consensus?

This question discusses a similar topic, but it is not the same issue.

Example questions of this form:

0

1 Answer 1

10

Personally, I don't like those questions.

  • If the asker really wants the feature to behave 100% exactly like in the other language, then answering the question requires wizard-level mastery of both languages in order to understand whether the two features really behave identical under every possible circumstance in every possible environment in every possible interaction with every possible other feature, which greatly diminishes the pool of possible answerers.
  • If, OTOH, the asker is only interested in a rough analogy or a subset of the feature, then she needs to specify what she is interested in in sufficient detail, but once she has done that, there is no need to even mention the other language.

There are so many intricacies in each and every language that having features in two languages that behave identical is pretty much impossible, so the OP needs to specify anyway which subset of behaviors she is interested in, at which point the question is usually precise enough that it doesn't even need the reference to the other language anymore.

Just looking at your three example questions:

  1. The first one fully specifies the intended behavior in terms of the type signature (the great thing about purely functional programming with an expressive, powerful, static type system is that you need to know only the types to figure out what a function does). It is a bit terse, but knowledge of Haskell and/or mapM is not required to answer the question. (In fact, if Scala had a search engine for type signatures such as Haskell's Hoogle, the question could be answered mechanically!)
  2. In this question, the mention of Haskell's undefined is actually confusing, and the OP is misrepresenting what undefined is. undefined is the bottom value, i.e. the value that represents computation that doesn't terminate (e.g. an infinite loop). The OP is not interested at all in that. All he wants, is a way to leave a piece of code un-implemented without generating a type error. You could remove any mention of Haskell and undefined, and the question would still be answerable.
  3. The question misrepresents / misunderstands how enrich-my-library (the new politically-correct spelling) actually works, and again, the mention of how it works in Scala is completely and utterly irrelevant, since the author is not actually interested in replicating the behavior of Scala, but merely wants a way to enrich existing types with new behavior. As this answer about the Unified Function Call Syntax proposal points out, the way to achieve that in future C++ is probably going to be completely different to what Scala does, so any mention of Scala is simply distracting and leads to answers like this which correctly points out that the equivalent mechanism to Scala doesn't exist.

So, in my opinion, the question requires a precise specification anyway, so that any mention of another language simply becomes an additional data point, but expertise in that language is not necessary (nor sufficient) to answer the question. Then, why tag it?

4
  • Yup. Question authors often use an "equivalent feature" formulation as a substitute for a precise specification of what they are looking for. Sometimes it gets in the way, sometimes it doesn't; in any case, it hardly ever is an essential part of the question.
    – duplode
    Apr 19, 2018 at 16:48
  • 1
    I submit that an expert in both languages would be able to tell which of those intricacies don't matter in the context of the question asked, and not have to worry about enumerating them all, every single time. You could write a novel about how far removed PHP's arrays are from any other key-value collection type in any other language ever... or you could just say that PHP's arrays are really just dictionaries or maps for the purposes of porting a C# class that stores some of its state in a dictionary.
    – BoltClock
    Apr 20, 2018 at 4:03
  • 3
    "once she has done that, there is no need to even mention the other language." - I don't wholly agree; it can still be useful for Googlers. If you know that another technology you used had a feature that you'd now find useful, and obvious thing to do is Google for something like "equivalent of array_map in javascript" or "equivalent of composer.lock in npm". If there are instances where those searches don't currently give good results, sucking them in and providing good answers to them on Stack Overflow can only be a useful thing.
    – Mark Amery
    Apr 20, 2018 at 11:44
  • 1
    I must agree with Mark Amery. Maybe it is an "additional data point", but it is an useful one for further searchers.
    – EMBarbosa
    Apr 20, 2018 at 18:26

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