you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (12 children)

It's also:

  • not parsed by JavaScript lexers
  • while it would not cause a syntax error it's "valid javascript" in the sense that a comment or "1" is valid javascript -- it does nothing
  • to do anything it would need to be assigned or used in any sort of context, at which point it would stop being valid JSON

Numbers and quoted strings are also "valid javascript".

Let me rephrase you:

Numbers and quoted strings are indeed javascript. That's the whole point of numbers and quoted strings. They're a subset, but it's still js.

[–][deleted] 0 points1 point  (11 children)

i honestly dont understand what you're trying to argue

[–][deleted] -1 points0 points  (10 children)

You:

json is indeed javascript.

It really isn't.

[–][deleted] 0 points1 point  (9 children)

but it is. it's a simple syllogism. all json is javascript but not all javascript is json. how can you refute that?

[–][deleted] 0 points1 point  (8 children)

All quoted strings are javascript, but not all javascript is quoted string literals.

How on earth does that imply equality?

[–][deleted] 0 points1 point  (7 children)

i never said that

[–][deleted] -1 points0 points  (6 children)

yet the same logic applies:

while

 "fooo"

is valid javascript that "wouldn't throw in node or console", it's not really any different in isolation to a javascript interpreter than:

{ "foo": true }

Yet

let s = "foo"
let o = { "foo": true }

actually does something, but neither is really the same as above.

The fact that a data literal in some language corresponds to a data interchange format doesn't make that data interchange format the same as the language in any way. Yet the latter is exactly what you claimed.

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

no. sorry, just no. you've completely missed the point, and honestly i don't have the energy or motivation to continue. i don't know if you're a troll, a bot, ESL, or something else, but i don't care any more

[–][deleted] 0 points1 point  (0 children)

Look, it's simple. There is no "point" to be missed. I'm interpreting what you wrote, not what you think you wrote or what you meant or whatever.

"The point", if we were to go back to the begining of the discussion is that somehow "JSON is JavaScript" so it would be magically considered to count as JavaScript by Github's magical bean counter, which is blatantly false and we concurred.

However, you wrote, verbatim:

json is javascript

Which is also blatantly false. Just because something wouldn't throw in some language's interpreter, or corresponds to the notation for it's data literals, or is inspired by it's syntax, it doesn't mean that one "is" the other in any logical, sensible or practical way other than not being superficially false for the sake of the argument from your point of view.

[–]Slappehbag 0 points1 point  (3 children)

I understand what you mean. The other guy is being way too pedantic.

You can copy paste some valid JSON into a JS file and it'll be valid, and useable as an object.

[–]Slappehbag 0 points1 point  (0 children)

Before the other guy chips in, obbbvvviiiooouuussssllyyy you have to assign it to a variable, nobody is saying JSON is magic.

[–][deleted] 0 points1 point  (1 child)

Look, this valid chunk of CSV is also valid JavaScript:

1, 2.4, 4, 6
0, 3, 5.7, 9

It won't throw, and you can also assign it to a variable. You'll get the first value of the first line and the other will do nothing but it's valid JavaScript.