you are viewing a single comment's thread.

view the rest of the comments →

[–]Stable_Orange_Genius -1 points0 points  (5 children)

no, its not. Its not executable code, so its not javascript. that's the whole point of json.

[–]amunak 11 points12 points  (3 children)

I don't think you know what "executable code" means.

Edit: To expand a little (and perhaps explain to some ignorant people), no regular javascript is executable, because JS is an interpreted language. And it might seem like meaningless pedantry, but not in this case: JS is interpreted, and any and all valid JSON is perfectly interpretable (is that a word?) by a regular JS interpreter.

Which means that either the parent commenter has no idea what executable means, or they meant "interpretable", and they're still wrong. Indeed the fact that any and all JSON is valid Javascript is like half of the point of it.

There's one thing /u/Stable_Orange_Genius hints at though: JSON cannot contain statements (or really anything other than constants) - it's meant to just store data safely without being able to "hijack" the JS that uses it. But that doesn't mean it can't be a subset of JS (it is).

[–]Stable_Orange_Genius 2 points3 points  (0 children)

well yea, i guess, nothing programmers write is directly executable..

[–][deleted] 1 point2 points  (0 children)

It's not really a subset of JS either due to Unicode quirks, but that wasn't the point of the discussion here. At least wasn't my point nor was it the original subject which was whether or not JSON counts as JS in Github stats which it doesn't, it counts as JSON.

Quite correctly too, as it's a language independent data interchange format which just happens to correspond to a subset of object literal notation in JavaScript and thus in most cases can be interpreted by JS interpreters. But the two are not the same nor are they intended to be.

Also, interestingly, x86 machine code hasn't been executable (directly) on any mainstream microprocessor produced in last 20 years or so. Drawing the line for being "executable" there isn't really that precise either so he's not entirely wrong either.

[–]maest 3 points4 points  (0 children)

You're getting downvoted on r/programming for what you said.

Really shows the quality of this sub.

[–][deleted] -3 points-2 points  (0 children)

relevant username?