6
\$\begingroup\$

I recently answered a polyglot challenge (my answer is here).

I'm using Python 2 and Python 3, abusing the floor division of py2. However, a commenter asked me if using the same language but different (major) versions is allowed. My question is, is this allowed? I recall seeing it before so I think so, but I would like to confirm.

\$\endgroup\$
  • 6
    \$\begingroup\$ We don't have a default for this, so it's up to the OP. \$\endgroup\$ – Dennis Apr 18 '17 at 13:17
  • \$\begingroup\$ @Dennis Alright, thanks. The commenter asked OP as well so I'll just wait for OP to answer. \$\endgroup\$ – user42649 Apr 18 '17 at 13:17
  • 4
    \$\begingroup\$ Personally, I think the default should be to disallow it. It trivializes the challenge a lot of the time, since the same language can always use the same tricks between versions. \$\endgroup\$ – mbomb007 Apr 18 '17 at 14:05
  • \$\begingroup\$ I recently had quite a bit of fun with this in codegolf.stackexchange.com/q/116152/8927, but made sure that the differences I exploited were somewhat relevant to the challenge (in this case, numeric differences, including the division difference you mention). It seemed to go down well. Had I used more general things (e.g. version check macros) I'm sure the response would have been more negative. Also I don't believe that it trivialises the challenge any more than the comment-in-one-language constructs which are used by a large proportion of the other language combinations. \$\endgroup\$ – Dave Apr 18 '17 at 20:18
  • \$\begingroup\$ @mbomb007 You could propose to disallow it under the loophole rule. \$\endgroup\$ – Mast Apr 18 '17 at 22:45
10
\$\begingroup\$

If the program is meant to do the same thing in two languages, this should probably be disallowed, for obvious reasons.

If the program is meant to do different things in the two languages, allowing this is more interesting, as the programs will have to be split away from each other somehow. Using a version check for this (or equivalent) is really boring, but has the issue that it's hard to ban in an objective way (it can sometimes be banned indirectly, via downvoting and/or pressuring the author into self-deleting the post). Solutions which rely on differences between the languages (especially if most people believe the language to be backwards-compatible), on the other hand, are often more interesting than solutions between two unrelated languages.

Note also that, in general, it's hard to define objectively if two languages are different versions of the same language. For example, is A Pear Tree a "version" of Perl, or V a "version" of Vim, or Vigil a "version" of Python? I don't think there's any way to create a rule here that's both loophole-free and objective, unless we move to an approach in which validity of a language depends on factors other than the definition of the language itself.

\$\endgroup\$
  • \$\begingroup\$ Why is it an issue for explicit version checks to be hard to ban? Not only is an explicit version check boring and unlikely to be upvoted, it also tends to take a lot of bytes; import sys;v=sys.version>'3', for instance. We don't need to ban it, such answers just won't often be competitive. \$\endgroup\$ – ymbirtt Apr 27 '17 at 9:26
  • 2
    \$\begingroup\$ @ymbirrt: There's at least one golfing language in which the meaning of @ (a rotate instruction for the top three instructions) was reversed from one version to the next, partly because the author preferred it that way, and partly to make language detection easy. Is that a version check or not? Either way, it's very terse. (Even in practical languages, a version check can be very short, e.g. $]<5 will distinguish between Perl 5 and Perl 4.) Note also that not all polyglot challenges have byte count as part of the victory condition. \$\endgroup\$ – user62131 Apr 27 '17 at 15:33
-1
\$\begingroup\$

Personally, I think that this should be allowed

In my opinion, using math tricks like this doesn't trivialize the challenge as much as using comments or no-ops to get rid of parts of the code in either language, which from my observation is what nearly every answer uses. Feel free to downvote and comment on this answer if you disagree with me, but if you agree, please leave an upvote so I can get a general consensus.

\$\endgroup\$

You must log in to answer this question.