3
\$\begingroup\$

In my most recent challenge, which was scored by number of languages in a polyglot the following question came up:

Do different [..] implementations of the same language count as different langauges ([...] like browser JS and Node.js)?

To which I couldn't find any prior ruling either on Meta or after a short search through other questions tagged .

So my question:
Is it sensible / should it be the default to recognize different implementations (with implementation-defined default extensions) as different languages?

(please note: the "yes" answer to the above was my tentative, preliminary ruling until confirmed / revoked via this meta Q&A)

\$\endgroup\$
  • 2
    \$\begingroup\$ The language is defined by the implementation, so yes. \$\endgroup\$ – Nathan Merrill Aug 6 '17 at 23:47
  • \$\begingroup\$ Personally, I'd say no; different implementations of the same language should not be counted as different languages for the purposes of polyglots. But I would be OK with that being a default rather than a consensus, which would allow it to be (explicitly) overruled on a per-challenge basis. \$\endgroup\$ – Shaggy Aug 6 '17 at 23:47
  • \$\begingroup\$ The issue with having a consensus for this is that each language and it's version can be different by different amounts. Lua 4 to Lua 5 can polyglot incredibly well, it's almost entirely the same syntax, Java 7 to Java 8 similarly, but Python 2 and Python 3 rarely can run the same code, even if you try to make it, and RProgN to RProgN2 essentially never can. \$\endgroup\$ – ATaco Aug 6 '17 at 23:51
  • \$\begingroup\$ @ATaco I think the difference between Python1 and Python2 is not nearly as large as you make it out to be. Usually the only difference between the two is print vs print() \$\endgroup\$ – Sriotchilism O'Zaic Aug 7 '17 at 0:05
  • \$\begingroup\$ @WheatWizard Still, the differences in other languages like RProgN 1&2 should be considered. \$\endgroup\$ – ATaco Aug 7 '17 at 0:05
  • \$\begingroup\$ I think this is more a problem on answer-chaining questions than polyglots. Claiming five different Python languages in the current OEIS chain due to PyPy feels like cheating to me. \$\endgroup\$ – Peter Taylor Aug 7 '17 at 6:54
11
\$\begingroup\$

They are different languages

On PPCG we define languages based on their implementations, it follows simply that different implementations are then different languages.

The problem

This is a not un-problematic, because it also means that different versions of the same language (e.g. 1.5.1 vs 1.5.2) are technically different languages because they have different implementations, even if the difference is a couple of small bug fixes. This leads to the absurd result of being to use every minor version of your favorite language to repeatedly answer questions that ban using a language twice. We have to draw the line somewhere or we may as well allow repeats in a language.

The solution

I think that every question that is concerned with "different-languages" should define what they mean by different languages, based on the behavior relevant to the challenge and not rely on a PPCG wide definition. An example of this is the Add a Language to a Polyglot that only requires languages have different output on the program in question to be considered different languages. This works out very well for that challenge. Obviously it will not always be this clean cut to find a good definition.

However questions should in general avoid defining this based on "major" and "minor" versioning systems (I have been guilty of this in the past myself), because such systems are not universal. Not all languages have version numbers, and not all languages that do have them put the same meaning into the numbers they provide. Definitions like this should probably be based on the behavior of the languages, to keep things objective.

\$\endgroup\$
3
\$\begingroup\$

Different implementations count as different languages.

Languages are defined by their implementation.

This isn't really problematic for most polyglots: Polyglots usually want you to do different things for each language, which means that they'd have to exploit the minute differences between the two implementations.

If the similarity of languages is an issue for a particular challenge, then we usually use the phrase "different versions of the same language" (which is problematic, but so is trying to make a challenge where you want lots of languages doing the same thing)

\$\endgroup\$

You must log in to answer this question.

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