18
\$\begingroup\$

Sometimes there are bugs in interpreters that make them unable to run programs that are valid by the specification of the language, or make them work incorrectly.

This will break programs using those features, which can be frustrating especially in code golf.


For example, let's assume that in the docs for the language Lang it says:

str.upper()

Return a copy of the string with all the cased characters converted to uppercase.

But then, when you try it:

>>> 'test'.upper()
'Test'

Assuming that all available interpreters have some bug that prevent the program from working, but the specification still defines how that program should work, will such bugs make such a program invalid if

  1. the interpreter is never fixed?
  2. the interpreter is fixed after the challenge is posted?
  3. the interpreter is intended to be fixed at some point after the challenge is posted?

In none of the cases could the program be run in an interpreter released before the challenge is posted, which is generally thought to be a requirement.

\$\endgroup\$
5
  • \$\begingroup\$ Well, considering how it's policy to have a functional interpreter... \$\endgroup\$ Commented Dec 27, 2015 at 17:22
  • \$\begingroup\$ Also, maybe a bit related(?). \$\endgroup\$ Commented Dec 27, 2015 at 17:31
  • 3
    \$\begingroup\$ Conversely, what if there is no documentation? \$\endgroup\$ Commented Dec 27, 2015 at 17:46
  • 1
    \$\begingroup\$ Is this a hint? :) \$\endgroup\$
    – Adnan
    Commented Dec 27, 2015 at 17:51
  • \$\begingroup\$ It would be interesting if a spec did define a language. I'd like to see some answers in Gravity or some halting-oracle language like Banana Scheme. \$\endgroup\$ Commented Apr 23, 2017 at 6:09

1 Answer 1

27
\$\begingroup\$

The interpreter(/compiler) defines the language

A spec is not a language. For the purposes of PPCG, a programming language is defined by its implementation.

If the interpreter is fixed after the challenge is posted, the answer must be marked as non-competing—just like any other answer in a language that was created after the challenge. This has been superseded by site policy, and no longer applies.

(On the flip side, this has the side effect that exploiting interpreter bugs is also perfectly okay.)

\$\endgroup\$
10
  • \$\begingroup\$ OK, so what if some, but not all, interpreters/compilers have the bug? Would the answer need to specify the compiler used? If I don't specify the compiler I use, and it doesn't have the given bug, but the question OP's does, making my code fail when they test it in their environment, does that invalidate my answer? Do I need to know about the bugs of every compiler in my chosen language? \$\endgroup\$ Commented Dec 28, 2015 at 3:49
  • 7
    \$\begingroup\$ @DanHenderson If your answer relies on interpreter-/compiler-specific behavior, yes, you need to specify which interpreters/compilers your answer will work on. You can generally assume that, say, most popular C compilers will be relatively bug-free ;) \$\endgroup\$
    – Doorknob
    Commented Dec 28, 2015 at 3:50
  • \$\begingroup\$ I'm assuming here that I am unaware that the bug in question even exists in another compiler. If the "compiler-specific behavior" on which my answer relies is simply "properly obeys the language's spec", then a literal interpretation of your last comment would be that all such answers must specify their compiler (other than, perhaps, those exploiting a bug that exists in all compilers/interpreters for the given language). \$\endgroup\$ Commented Dec 28, 2015 at 4:12
  • \$\begingroup\$ Partially agree, but I think exploiting bugs is bad too. \$\endgroup\$
    – Xwtek
    Commented Dec 31, 2015 at 11:55
  • \$\begingroup\$ @ChristianIrwan depends. It can be a refreshing change if done sparingly. \$\endgroup\$ Commented Jan 1, 2016 at 14:49
  • 3
    \$\begingroup\$ +1 for the flip side \$\endgroup\$
    – edc65
    Commented Jan 5, 2016 at 8:26
  • 3
    \$\begingroup\$ @DanHenderson if someone testing your code find a problem, they will probably point that out in a comment. Then you can specify which interpreter should be used. This is a community, we communicate each other. \$\endgroup\$
    – edc65
    Commented Jan 5, 2016 at 8:30
  • \$\begingroup\$ What if few interpreters have the bug and most do not? And what if most have the bug and few do not? \$\endgroup\$
    – Arjun
    Commented May 5, 2017 at 3:56
  • \$\begingroup\$ "A spec is not a language." This seems logically and demonstratively false. In fact, it is an utterly absurd claim from my perspective. The spec is the language, because it sets out to define the language. There would be no language without the spec! An implementation is certainly not "a language", and an implementation is not even required for a language to exist. \$\endgroup\$ Commented May 5, 2017 at 12:35
  • 1
    \$\begingroup\$ @CodyGray This definition would work best for PPCG regardless of how true it is everywhere else. \$\endgroup\$
    – MilkyWay90
    Commented Mar 26, 2019 at 0:17

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