8
$\begingroup$

It may be tempting to ask questions about why your favorite languages is missing a specific useful feature. I have seen (and posted) such questions on Software Engineering. Their reception is mixed. I can see how one could argue that they are opinion-based, or not particularly constructive (The answer is just 'That's the way it is.'). However, sometimes there is a particular, insightful reason to not implement a certain feature for a certain language.

What should be the guidelines with regards to 'Why doesn't <x> language have <y> feature?' type questions?

$\endgroup$

2 Answers 2

10
$\begingroup$

Allow with edits

Allow them, but edit the question to be phrased constructively. "Why doesn't C++ have sum types?" is likely to devolve into opinion-based answers, but with some minor modification, any of the following extremely similar questions seem more objective and thought-provoking:

  • What would it take to add sum types to C++20?

  • Could a C++-like language support sum types?

  • How would adding sum types to C++ change the existing type system?

$\endgroup$
3
  • $\begingroup$ wait- doesn't c++ already support sum types since v17 with std::variant? and you could do tagged unions manually before that with union. $\endgroup$
    – starball
    Commented Mar 4 at 0:48
  • $\begingroup$ @starball Debatable. I don't consider those solutions satisfactory. std::variant is, at best, the visitor pattern supplied by the standard library. No syntax support, no proper pattern matching, no interaction with the type system. As implemented, it could've been a library feature (and, in fact, it was for a long time in Boost). $\endgroup$ Commented Mar 4 at 3:28
  • $\begingroup$ I've heard Herb and others are working on is and pattern matching (and other things (cppfront)). Not sure how that's going along. $\endgroup$
    – starball
    Commented Mar 4 at 3:41
0
$\begingroup$

So long as they can be answered with facts, allow them.

$\endgroup$

You must log in to answer this question.

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