If someone answers a challenge in, for example, JavaScript, and as an additional challenge restricts to only code that is approved by http://www.jslint.com/ that answer is valid if an interpreter exists that only accepts code that passes JSLint.

However, without the existence of such an interpreter, the answer contains non-essential whitespace and would be seen as not a serious contender, and would be subject to deletion based on the consensus in Can serious contenders do more than the challenge asks for?

My question here is whether that interpreter needs to be written before the answer would be valid. Is the existence of a JS interpreter and a separate JS linter sufficient to justify posting linter-golf answers, or must a new interpreter be written for each linter-language combination someone wants to use?

  • \$\begingroup\$ There's some precedent for this sort of thing. The most common example are answers that do the task without a particular built-in or library. Obviously, this has potential to be abused, but let's make a rule if that actually becomes an issue. \$\endgroup\$ Commented Dec 5, 2018 at 21:29
  • \$\begingroup\$ Possible duplicate of Can serious contenders do more than the challenge asks for? \$\endgroup\$ Commented Dec 5, 2018 at 21:31
  • 1
    \$\begingroup\$ I can't see a way to write an interpreter that makes an answer valid that does things the challenge doesn't ask for, but it is trivial to write an interpreter than only works for code that passes JSLint. This makes me think this is a sufficiently different question to not be a duplicate. \$\endgroup\$ Commented Dec 5, 2018 at 21:32
  • \$\begingroup\$ Fair enough, but: if the answer is "Yes", then we're in the same situation as before. If the answer is "No", then we are a weird situation were self-imposed restrictions that are easy to automatically check for aren't allowed, but self-imposed restrictions that are difficult to check for are allowed. \$\endgroup\$ Commented Dec 5, 2018 at 21:38
  • 3
    \$\begingroup\$ Having read through the answers to the linked question I can see there is more overlap than I'd expected. The answer with clear consensus suggests non-essential whitespace makes an answer invalid. Linter golf would require including whitespace that is non-essential to the underlying language, but essential to the linter. With a custom made interpreter it would definitely be essential whitespace, but without it I don't know whether it would still be acceptable, which is what I'd like to find out. \$\endgroup\$ Commented Dec 5, 2018 at 21:43
  • \$\begingroup\$ That's a much better point IMO :) I'll retract my close vote. I'd definitely mention that in your post. \$\endgroup\$ Commented Dec 5, 2018 at 21:44
  • \$\begingroup\$ Thanks! Just trying to think how to reword it. I might need to golf my question... \$\endgroup\$ Commented Dec 5, 2018 at 21:45
  • \$\begingroup\$ I've now golfed the question. Hopefully that's clearer... \$\endgroup\$ Commented Dec 5, 2018 at 21:51
  • \$\begingroup\$ People can just write such an interpreter for that "chained programming language" and avoid the ambiguity... \$\endgroup\$
    Commented Dec 6, 2018 at 4:52
  • \$\begingroup\$ Anyway, I think that such programs are not interesting --- at least, not as interesting as restrictions such as "there must be no two consecutive non-whitespace character", or "there must be no string used in the program", or some subset of bytes are banned, etc. -- as rewriting a program to satisfy a linter is trivial. \$\endgroup\$
    Commented Dec 6, 2018 at 15:52
  • \$\begingroup\$ Rewriting to satisfy a linter is indeed trivial, but that trivial rewrite is unlikely to be the shortest possible code that satisfies the linter. Which algorithm gives the lowest golf score may be completely different between JS and JSLint \$\endgroup\$ Commented Dec 6, 2018 at 21:14
  • 1
    \$\begingroup\$ So...Any JSLint answers? I'd be rather interested in looking at some of them. \$\endgroup\$ Commented Dec 18, 2018 at 4:00

1 Answer 1


Chaining multiple existing programs together is an acceptable implementation

This has precendent in any language with a separate compilation/parsing/translation step before execution (like C, C++, Java, etc.). In these languages, you invoke one command to create executable code/bytecode/whatever, and then invoke a separate command to actually run the output of the first command.


  • Java: javac Foo.java && java Foo
  • C/C++: gcc -o foo foo.c && ./foo
  • Haskell: ghc -o foo foo.hs && ./foo

...and so on.

Therefore, it would be perfectly reasonable to allow a new language (Lintless JavaScript?) to be defined as node jslint.js foo.js && node foo.js (or similar). Browser implementations would be a bit different to invoke, but in general we don't exclude implementations that can't be run from a command line (so long as they are usable in some manner), so they would also be valid.

Naturally, as variations can exist between different linters for the same language, each combination of linter and language implementation would be considered its own language by our rules.

  • 1
    \$\begingroup\$ You already wrote an answer that is consensus, and briefly mentions that a transpiler is sufficient to define a language: codegolf.meta.stackexchange.com/a/7630/39328 \$\endgroup\$
    – lirtosiast
    Commented Dec 6, 2018 at 5:00
  • \$\begingroup\$ @lirtosiast This case is different, because there is no modification of the code - it's simply determining whether the code meets some criteria, and if not, not running the code. \$\endgroup\$
    – user45941
    Commented Dec 6, 2018 at 5:43
  • \$\begingroup\$ It's not different from a "transpiler" that outputs nothing if it doesn't satisfy the linter. \$\endgroup\$
    Commented Dec 6, 2018 at 15:04
  • \$\begingroup\$ @user202729 That's a fair interpretation. I didn't think of it that way. \$\endgroup\$
    – user45941
    Commented Dec 6, 2018 at 17:56
  • 1
    \$\begingroup\$ I like having this as a separate answer even if it overlaps to some extent with your previous one. Much easier to link someone to this clear explanation of one specific case than to get into a long argument over how the general answer applies. It also allows consensus to be shown here which makes a stronger case \$\endgroup\$ Commented Dec 6, 2018 at 21:10
  • 3
    \$\begingroup\$ @trichoplax I agree. Explicit is better than implicit. \$\endgroup\$
    – user45941
    Commented Dec 6, 2018 at 21:31

You must log in to answer this question.

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