-2
\$\begingroup\$

JavaScript ES6/7 is a popular language on PPCG, but currently there is no definition for "JavaScript".


JavaScript is a language with many implementations. Ecma international defines the specifications and standards for JavaScript. For JavaScript ES5, an older version of JavaScript, Ecma has released a finalized version of the EcmaScript 5 standards, but only a draft exists for EcmaScript 2015 (ES2015 (ES6 / ES7)).

Because EcmaScript only defines the specification, many JavaScript engines exist. All these engines result in discrepancies between various JavaScript versions.

No browser perfectly implements the EcmaScript specifications either, making it difficult to objectively specify what engine should be considered "JavaScript".


No engine currently supports ES2015; neither does any transpiler. So I've made a meta discussion to decide on what JavaScript should be defined as.

I'd say it's straightforward to define JS as a popular engine defines it, but feel free to propose something else. I'm not saying to define JS only as a specific engine, just this is a straightforward way I've thought to specify it.

| |
\$\endgroup\$
  • 6
    \$\begingroup\$ I don't think a "default" is a good idea here. If an answer only works in a particular implementation, the answer should state that. \$\endgroup\$ – Dennis Mar 29 '16 at 1:43
  • \$\begingroup\$ It's probably worth noting that BF is another language with multiple implementations, though that's more because the spec wasn't specific enough. \$\endgroup\$ – El'endia Starman Mar 29 '16 at 1:43
  • \$\begingroup\$ @Dennis most JavaScript answers are "implementation specific". Should almost all JS answers be labeled specifically? That's why I'm simply proposing a "default" engine (which (should) be one with very wide support). If a JS answer is pretty implementation specific after that, then it should be labeled. \$\endgroup\$ – Downgoat Mar 29 '16 at 1:44
  • 2
    \$\begingroup\$ Yes, I think so. User tests answer in his browser, complains that it's not working, gets directed to meta post, tests answer with proper interpreter is a lot of steps considering that all but the last one could be avoided. \$\endgroup\$ – Dennis Mar 29 '16 at 1:47
  • \$\begingroup\$ @Dennis so you're saying every JS answer should have a link to the engine the author used? \$\endgroup\$ – Downgoat Mar 29 '16 at 1:49
  • \$\begingroup\$ Not necessarily a link; a simple tested in... would suffice. \$\endgroup\$ – Dennis Mar 29 '16 at 1:50
  • \$\begingroup\$ @Dennis pretty much the same thing could be said for all defaults we have defined. Just someway to define "regular" JavaScript, what is "regular JavaScript"? That is what this post is to define. \$\endgroup\$ – Downgoat Mar 29 '16 at 3:58
  • 1
    \$\begingroup\$ You have some outdated information. ES6 is not a draft. Chome now supports more then 91%. Nodejs has good support too. kangax.github.io/compat-table/es6 \$\endgroup\$ – Qwertiy Mar 29 '16 at 6:57
10
\$\begingroup\$

I can see how this might be a tempting idea, but I think it will cause more problems than it will solve, particularly because we define languages by their implementations, not by their specifications.

A lot of languages have a lot of implementations, all with various differences. It's fine to label the language as simply "JavaScript" if it will work with any implementation. But if the submission relies on features only available in a specific implementation, that should be mentioned somewhere in the post. It could be the header, like "JavaScript (SpiderMonkey), 123 bytes," or it could be something along the lines of "I tested this in SpiderMonkey" somewhere in the post body.

This is common practice with other languages, for example APL. That's why there are posts that say APL, Dyalog APL, ngn/apl, etc. Each implementation has features that distinguish it from the others, and when a submission requires a feature specific to a particular implementation, it's noted as such.

To avoid confusion, it's always better to be explicit than implicit. As Dennis mentioned in a comment, in the absence of a specified implementation, a passer by (or even the OP) would likely just test the code in their own browser console, which may or may not support all features required by the submission, possibly leading to confusion that could have been avoided from the start.

| |
\$\endgroup\$
  • \$\begingroup\$ Maybe the title was misleading. I'm not talking about a specific engine which is to be labeled "JavaScript". More of the definition of JavaScript, what's the separating line between JS and let's say CoffeeScript (that may be obvious but it's just an example). I'm asking for a consensus on what we should consider the definition of "JavaScript". I've listed engines because it would be straightforward to specify JavaScript as a language working in this implementation. Again, as languages are defined by their implementations, all JS engines are different, does that make them different languages? \$\endgroup\$ – Downgoat Mar 29 '16 at 3:36
  • 1
    \$\begingroup\$ @Downgoat Part of the post is misleading as well, because you still mention choosing a default engine. But all of the engines share a core set of features, correct? If so, my notes regarding how to specify which engine was used still apply (e.g. labeling it "JavaScript (SpiderMonkey)" or whatever). \$\endgroup\$ – Alex A. Mar 29 '16 at 3:42
  • 1
    \$\begingroup\$ "in the absence of a specified implementation" : Even as a regular user, I usually just test these in my currently open browser. If you know what it works in (and/or know it doesn't work in everything), please specify. \$\endgroup\$ – Geobits Mar 29 '16 at 17:08

You must log in to answer this question.

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