This question already has an answer here:

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.

marked as duplicate by Martin Ender Jun 19 '17 at 10:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Well, considering how it's policy to have a functional interpreter... – Addison Crump Dec 27 '15 at 17:22
  • Also, maybe a bit related(?). – Addison Crump Dec 27 '15 at 17:31
  • 2
    Conversely, what if there is no documentation? – Conor O'Brien Dec 27 '15 at 17:46
  • 1
    Is this a hint? :) – Adnan Dec 27 '15 at 17:51
  • 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. – Esolanging Fruit Apr 23 '17 at 6:09
up vote 24 down vote accepted

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.

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

  • 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? – Dan Henderson Dec 28 '15 at 3:49
  • 5
    @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 ;) – Doorknob Dec 28 '15 at 3:50
  • 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). – Dan Henderson Dec 28 '15 at 4:12
  • Partially agree, but I think exploiting bugs is bad too. – Akangka Dec 31 '15 at 11:55
  • @ChristianIrwan depends. It can be a refreshing change if done sparingly. – John Dvorak Jan 1 '16 at 14:49
  • 3
    +1 for the flip side – edc65 Jan 5 '16 at 8:26
  • 2
    @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. – edc65 Jan 5 '16 at 8:30
  • What if few interpreters have the bug and most do not? And what if most have the bug and few do not? – Arjun May 5 '17 at 3:56
  • "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. – Cody Gray May 5 '17 at 12:35

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