-15

https://stackoverflow.com/questions/33408414/like-concatenation-operator-why-isnt-there-operator-overloaded-for-str

As a developer, I got this doubt and wanted to get it clarified. This question was put on hold, saying:

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.

I want opinions. I will go with the convincing one. If it is required to be only fact-based, let it be open instead of holding it. Why is the scope reduced like I have done something wrong?

6
  • 4
    Questions asking for opinions don't always suit Q+A as there needs to be an objective answer. I guess people don't think there's an objective answer to the question, or that only the developers themselves could actually answer with authority, so they've voted to close
    – Clive
    Commented Oct 29, 2015 at 9:50
  • Didn't you also cross-post it to Programmers? That's pretty bad form. Edit: nope, perhaps just a weird coincidence: programmers.stackexchange.com/q/301114/110531
    – jonrsharpe
    Commented Oct 29, 2015 at 10:05
  • 2
    If you want opinions, then try another site - perhaps Yahoo Answers! For objective answers, we're here to help.
    – DavidG
    Commented Oct 29, 2015 at 10:20
  • 1
    It was placed on hold "because". Ironically, that's also the answer to your closed question.
    – user1228
    Commented Oct 29, 2015 at 15:55
  • Actually, I think that the answer on Programmers shows an example of how this should have been phrased.
    – Makoto
    Commented Oct 29, 2015 at 17:19
  • @Boann: Be that as it may, there are some key differences between the two. The one on Programmers asks objectively about why - may not be used for removing strings, whereas the one here asked why the developers didn't bother to implement the operator for strings. I don't deny the involvement of Wiki magic, but the question on Programmers is just less subjective and has a very concise answer to it, too.
    – Makoto
    Commented Oct 29, 2015 at 17:28

3 Answers 3

15
  1. Because SO is designed that way. By definition questions about opinions are off-topic. You may not like that, but that's the way is.

  2. Because the question contains opinions: we need to have, there should have been and this makes it easier.

  3. Because the 'proposal' is ambiguous, as indicated by/in the list of comments. Even if you propose a strict definition of the operator in your question, it will lead to debate about which definition is 'better'.

  4. Even the question "Why the developers have refrained from overloading it?" is ambiguous because there is no clear definition of the proposed operator. Maybe some historical info can be found about the developers having considered a - operator, but that should have been in the question then. Then the reference would immediately provide the answer, so not much of a question remains.

4
  • So there's no way to get such things clarified on SO? :-( Commented Oct 29, 2015 at 9:56
  • No not really. Maybe a more specific question like "I found this info about the developers thinking about but not implementing X, but I do not understand their arguments Y, Z"
    – Jan Doggen
    Commented Oct 29, 2015 at 10:00
  • 5
    There is a way- if you get lucky and the question will be reopened and some desperate rep whore will try his luck. Commented Oct 29, 2015 at 10:01
  • 4
    And look what I just come across: programmers.stackexchange.com/questions/301114/…
    – Jan Doggen
    Commented Oct 29, 2015 at 10:14
0

You can never answer "Why have [people] not done [something]". You would have to ask everyone who might have done [something] why - which is patently laughable.

What you can do, however, and thus what you could ask if you wanted to, is find out what barriers exist to doing something. This is often what the first kind of question is really asking, of course - for a suggestion of the most common/significant barrier(s).

See these two questions:

Why has nobody ever made a sandwich with ranch AND thousand island dressing on it?

vs

Would the taste profiles of ranch and thousand island dressing conflict if I put them on a sandwich together?

The second question is answerable. The first isn't really, unless you convert it to the second question in your head. The first is even less answerable because it's probably not true; similarly in your question, I'd be shocked if nobody had ever overloaded the - operator to work on strings. It's just not common (nor is it part of the language).

So, if you want to know why it's not overloaded, you need to ask a more pointed, specific question, finding out what might cause it to not work. To make it a good question, you'd need to have some idea of how you would overload it I suspect; otherwise it's too broad (don't expect your audience to have to decide what the 'natural' or 'obvious' overload is: propose it). Then ask if that is a reasonable way to overload - in your language(s), and what might be problematic with implementing that.

1
  • "What you could ask if you wanted to, is find out what barriers exist to doing something." On Stack Overflow, any such question would be immediately closed as "too broad" (along with a few cries of "What happened when you tried?"). It's everyone's favorite "I can't be bothered to answer this but want to feel useful so I'll vote to close instead" reason.
    – Boann
    Commented Oct 29, 2015 at 17:30
-2

I believe it is possible to have an objective discussion about the utility of - on strings and I don't agree with the close reason. But your question suffered for several reasons:

  • It was unclear, because you didn't specify what semantics that the - operator should have. As seen from the responses, there are a lot of details that need to be worked out about how - should behave on strings. That made the question more difficult to precisely answer.
  • You tagged three major programming languages ( ) which rapidly brought a lot of attention to the question, which led to it being judged more harshly. (It takes exactly 5 people to close a question, yet some tags get many more viewers than others.)
  • The tags weren't very specific to the question. Better would have been something like: .
  • Some people might have felt that the answer was obvious. E.g., There are no clear, agreed semantics to - on strings.
  • There is an almighty ocean of crap questions constantly on the verge of drowning Stack Overflow, and that has made Stack Overflow users very defensive. This results in collateral damage, where in an effort to keep the site clean, users downvote or close some answerable questions too hastily. (In fact, sometimes people find a question they don't like, then work backwards to concoct a reason to close the question, and will choose a close reason from the list even if it doesn't apply. I'm not saying that's what happened here, but it does happen.)

Note that it's possible that only 3 out of the 5 close voters may have thought the question was too opinion-based. The other two might have voted to close for other reasons, such as "unclear" or "too broad", but the individual reasons are not displayed.

With different tagging, and a clearer demonstration of the intended semantics of the - operator, your question might have survived. However, there is already a similar question with answers on Programmers SE.

1
  • No, I doubt the question would have survived. It was part rant, part something only the language designers could have answered.
    – Makoto
    Commented Oct 29, 2015 at 17:17

You must log in to answer this question.

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