0
\$\begingroup\$

Suppose one answers a code-golf challenge for a language with a solution which is ill-formed according to the spec of the selected language.

"But it works nonetheless with all major interpreters".

Is the answer considered valid?


Exemple:

Challenge: print this text: Hello, World!.

Solution: HTML, 19 bytes: <html>Hello, World!

Discussion: Most (all?) browser would indeed print the exact text Hello, World!, even though the code snippet is not a valid HTML file. Should OP accept this answer?

\$\endgroup\$
2
  • 3
    \$\begingroup\$ We define languages by their implementation. An answer is valid if and only if it works with a pre-existing implementation, so programs that violate the spec but work is practice are accepted, while program that adhere to the spec but do not actually work (interpreter bug, etc.) are considered invalid. \$\endgroup\$
    – Dennis
    Commented Apr 27, 2017 at 14:37
  • 1
    \$\begingroup\$ More specifically, it doesn't need to "work with all major interpreters" as long as you can find a single interpreter where it works. \$\endgroup\$ Commented Apr 27, 2017 at 19:15

0

Browse other questions tagged .