11
$\begingroup$

Suppose I were to ask the following question:

I am designing an object-oriented language with classes, and I’m trying to decide what syntax to use to define a class’s constructor. Even among popular languages, several different syntaxes exist. What are some of the different options, and what are their tradeoffs?

This question is rather broad, and arguably it has infinitely many potential answers, but it is about programming language design in some sense. Would this question and other questions like it be on-topic?

$\endgroup$

2 Answers 2

8
$\begingroup$

No, these questions should be off-topic

Open-ended questions of this form are a poor fit for our site, for several reasons:

  • There are infinitely many potential answers. Anyone could come up with their own wacky syntax of choice, and it would be a legitimate answer to the question.

  • The “advantages” and “disadvantages” of different options are likely to be almost entirely subjective, so it is impossible to decide which answers are correct. Voting degrades to a popularity contest.

  • It is difficult to decide what constitutes “different syntaxes”, and it’s not clear how to handle two different answers proposing very similar syntaxes with minor differences.

  • These questions do not require expertise in programming languages and are likely to attract low-quality answers. They suggest that the field of programming languages is essentially about bikeshedding when in fact this is really not the case. See also How to beat Wadler's law?

Syntax is largely a matter of taste. There is precious little evidence to suggest that different choices of syntax have any meaningful impact on the usability of a language beyond the impact of simple familiarity. Just as it would not be on-topic to ask about different options to name a programming language, it is not on-topic to ask for a big list of different syntaxes for a given language feature.

Exception: Human factors questions seeking evidence

As a major exception to the above, I believe that questions about the pros and cons of syntax that are explicitly seeking empirical evidence should be on-topic. These questions do have objective answers, they do require programming language expertise, and they can be very useful to a working programming language designer.

Answers to questions of this form must provide citations of some kind, but they do not necessarily need to be to peer-reviewed studies. For example, this answer cites the prevalence of Stack Overflow questions about a particular feature, which provides a real signal that it may be confusing. Answers do not need to be completely rigorous—if we required that, very few of these questions would be answerable—but we should hold answers to these questions to a significantly higher standard. Answers that merely provide opinions or personal anecdotes should be downvoted and potentially deleted.

$\endgroup$
2
$\begingroup$

I think we should exercise caution here, because this affects a not-insignificant proportion of questions on the site. I did a search for "what syntax is:q" and I think about 27 of the results are questions of the kind discussed here. That currently represents over 5% of our existing questions.

The goal is to raise our standards and improve the quality of questions (and the answers they attract), and of course that is a good goal which I approve of. Like others, I also think it's not great for us that over 5% of our questions are of this kind, where answers can only be voted on based on subjective preferences for some syntaxes over others. (And personally, I don't find these questions interesting.)

Still, the fact that we have these questions and they have so far been well-received by the community suggests to me that there are quite a few people who value "syntax options" questions, and there could be a backlash particularly from people who see their questions getting closed despite having decent scores and plenty of answers. So I'd like to look for ways that we can raise the standards for these questions without outright excluding most of them.

Quoting from Alexis's answer:

Syntax is largely a matter of taste. There is precious little evidence to suggest that different choices of syntax have any meaningful impact on the usability of a language beyond the impact of simple familiarity.

While this is true, it doesn't imply that the only exception we should make is for syntax-options questions seeking empirical evidence about human factors.

What matters for a Q&A site like ours is that questions should seek answers which are objective, useful, and which can be voted on objectively. With that in mind, I would like to propose a couple of further exceptions:

  • Questions seeking syntax options in use by existing popular languages, particularly where families of languages share the same syntax. This can be answered objectively, and the information is useful for establishing familiarity in the syntax of a new language (which as mentioned, has an impact on usability). Answers can be voted on based on how comprehensive they are; answers are also better if they identify common syntactical features of larger groups of languages, or the reasons why existing languages have adopted these syntaxes (if there are any besides familiarity).
  • Questions seeking syntax options subject to specific constraints of a particular language. Constraints often come from the other syntax already in use by the language, combined with the need for an unambiguous grammar which can be parsed without too much lookahead, or from wanting to give good syntax error messages. Other language-specific constraints might be e.g. the need for a markup language to avoid giving special meaning to punctuation that is likely to occur in text written in natural language. Answers are better if they meet the constraints more closely, and if they include justifications of why the proposed syntax meets the constraints.

More generally, if a syntax-options question includes its own objective criteria that voters can use to judge answers, then I think that should weigh in favour of the question being on-topic.

$\endgroup$
1
  • $\begingroup$ I agree that “questions seeking syntax options in use by popular languages” is a potentially legitimate exception, and I almost included it in my answer. I eventually decided not to include it, as I don’t really want to encourage those questions, but I think there are cases where those questions could be both objective and useful. Your second bullet I’m somewhat less convinced by, but I think I agree that there are questions along those lines that could be on-topic, and I broadly agree with your final sentence. $\endgroup$
    – Alexis King Mod
    Commented Aug 5, 2023 at 15:32

You must log in to answer this question.

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