News for hackers. Stuff that matters.
Re:Angular v8.0 by benatkin on Wednesday May 29, 2019 @09:14AM (#20039730)
JavaScript with JSX is a single language. The tags are a syntax extension. JSX is a very non-leaky abstraction. The tags are just function calls. https://reactjs.org/docs/introducing-jsx.html#jsx-represents...
Re:Angular v8.0 by royjacobs on Wednesday May 29, 2019 @09:25AM (#20039837)
I don't buy that argument. On the one hand you claim there's no leaky abstraction, yet your argument only works if "Javascript with JSX is a single language".

Then "C++ with inline assembler" is also a single language? What about English with quotes in Japanese?

Re:Angular v8.0 by kaoD on Wednesday May 29, 2019 @09:47AM (#20040071)
JSX is syntactic sugar for JS[0]. C++ and ASM (actually, _which_ ASM?) are different languages.

[0] https://fettblog.eu/jsx-syntactic-sugar/

Re:Angular v8.0 by royjacobs on Wednesday May 29, 2019 @10:00AM (#20040245)
Since JS is the only thing you can actually use[1] in a browser you can argue that anything that runs in the browser is syntactic sugar (and in fact, Typescript is syntactic sugar).

A less flippant analogy might be macro support in Rust. It's clearly part of Rust, but the syntax is completely different and it requires IDEs to have completely separate processing just to handle it. I wouldn't consider that to be mere syntactic sugar either.

[1] Yes, yes, wasm

Re:Angular v8.0 by kaoD on Wednesday May 29, 2019 @10:06AM (#20040318)
JS and JSX are isomorphic (in the mathematical sense) hence why JSX is considered just syntactic sugar.

JS and TS aren't isomorphic (there's no inverse morphism once you go TS->JS that can bring the resulting JS back to the original TS) hence why TS is a different language (even if a superset of and compiled to JS).

Re:Angular v8.0 by lostjohnny on Thursday May 30, 2019 @05:59AM (#20049718)
> JS and JSX are isomorphic

They are not

Or, if they are, they are in the same way of a custom XML templating language that can be translated to a specific javascript library implementation and then back to XML

In the same way, is Mustache isomorphic?

    "{{title}} spends {{calc}}"
can be translated to

    `${title} spends ${calc}`
and back to

    "{{title}} spends {{calc}}"