# How to count languages?

A common problem for and challenges (and some s) is to decide when two different languages/dialects are different enough to be counted separately. Common borderline cases are C/C++, ECMAScript 5/6, Python 2/3. Very often it's possible to get one of those for free. People try to rule those out by saying things like "you may not count two versions of the same language", which gets the last two cases. But stuff like C/C++ is usually harder to rule out.

I'm asking because I'm considering to change this proposal to score by the number of different languages used.

Can we come up with some standard rules for when two languages are considered different enough for the purposes of these challenges?

• I never imagined C and C++ being considered the same language. – feersum Oct 28 '14 at 0:02
• This is still very ambiguous but I'd say languages are different if they are referred to by different names. So C and C++ are different, but when someone says Python there's no telling if the mean 2 or 3, so they are the same. – Calvin's Hobbies Oct 28 '14 at 0:46
• @feersum It just leads to some awkward situations in rosetta stone challenges, where you submit a C program and add both C and C++ to your count. – Martin Ender Oct 28 '14 at 6:51
• Perl5 and Perl6 are from the same family but they are considered different languages. When people say Perl, they are referring to Perl5 most of the time. It would be nice to have a standard saying Perl5 and Perl6 are considered the same/different languages unless specified in the question when dealing with Rosetta Stone type challenges so you wouldn't have to ask every time. – hmatt1 Oct 28 '14 at 22:14
• – user62131 Apr 24 '17 at 23:54

Can we come up with some standard rules for when two languages are considered different enough for the purposes of these challenges?

I seriously doubt it.

Whether, e.g., C and C++ should count as different languages depends on the other winning criteria.

• For , C and C++ are probably not different enough to count as two languages. Writing code that simply works in both is trivial, so that would be an extra point without any effort.

• In a challenge, submitting a program that will work in C and C++ is probably going to lose in both categories. Counting them as two languages makes sense, since you'll have to write two different programs.

• However, with polyglots, its worth noting that due to the implicit int, solutions that support both C and C++ may be longer. – matsjoyce Nov 4 '14 at 20:06
• @matsjoyce: For polyglots, we usually count the number of languages, not the number of bytes. At least that's the assumption I've made for the first bullet point. – Dennis Nov 7 '14 at 4:32
• I'm sure somebody can think up a challenge that uses both number of languages and length... score = length - num_lang * 2 – matsjoyce Nov 7 '14 at 10:48
• @matsjoyce: That just reinforces my point. Without knowing the winning criteria in detail, deciding whether C and C++ count as one or two languages is not a good idea. – Dennis Nov 7 '14 at 13:14

# Count language. Ignore Version.

Rule

Two languages are the same if they have the same name, excluding the version.

Examples

Java 7 and Java 8 count as one point.

C and C++ count as two points.

• Is ++ a version? – Ypnypn Oct 29 '14 at 0:19
• Is C really just the next version of B? – Blue Jun 27 '16 at 8:10
• Is JavaScript, JScript, ActionScript, ECMAScript, 4 languages? (And maybe TypeScript, CoffeeScript, etc... – tsh Apr 8 '18 at 6:59
• @tsh If you have a new question, use the "Ask Question" button. – Rainbolt Apr 8 '18 at 7:24

# Make a list.

Rule

Two languages are the same if they belong to the same class, as designated by the community.

The community could develop a list stating that, for example, C and C++ belong to the same class. This is the most flexible method as it allows the community to reach a "best judgement", but it probably requires a lot of overhead.

Example List

• Class 1: C, C++
• Class 2: All versions of a particular language not present in another class
• Class 3: Python 2
• Class 4: Python 3

Please note that I wouldn't actually count Python 2 and 3 separately. Just trying to demonstrate the flexibility of this method.

Example Cases

Java 7 and Java 8 count as one point.

C and C++ count as one point.

Python 2 and Python 3 count as two points.

# The author is the judge.

This one is self explanatory.

• While I trust some authors to be up to the task, I personally don't want to have to make the decision, especially in cases where I'm not familiar with the differences between languages/versions/dialects. I would like the result of this question to be a default choice - as with most of our standard rules, the author can always override them if he wishes to. – Martin Ender Oct 28 '14 at 18:42

# Count language. Count Version.

Rule

Two languages are the same if they have the same name and version.

Examples

Java 7 and Java 8 count as two points.

C and C++ count as two points.

• I don't like this way of doing it. You could, say, count 8 versions of Java. Oh and what about subversions? Python has features in say 2.7 that aren't in say 2.4, so they could be called different versions. And then there's C++98, C++11, ... – Justin Oct 28 '14 at 18:25