
Ask HN: Why can't JSX be added to the language? - osdevisnot
JSX is such a nice abstraction to work with. Why why why why why why why why why can&#x27;t we make it part of the language
======
acemarke
Funny you should ask that. Someone asked that exact question in Reactiflux a
couple days ago. This was my response:

> Many reasons. For one, anything that the browser supports now, it has to
> support... forever. For another, all browsers up until now don't support JSX
> syntax, so you'd still have to compile your code to handle all existing
> browsers.

> Also, the JSX syntax is not React-specific. Typical usage is to compile
> `<MyComponent>` to `React.createElement(MyComponent)`, but you can edit your
> build settings to compile it to other similar APIs for other frameworks.

> The JSX syntax has been pretty stable for a while, but there's been plenty
> of proposals to tweak it further. How would that get handled?

~~~
osdevisnot
I guess your reasoning makes sense, but obviously there are counter arguments:

> Compiling for older browsers seems ok. If we stop additions for this reason,
> we would essentially stagnate the whole ecosystem.

> Sure, JSX is not react specific. No arguments here, but we should be able to
> come up with some convention - maybe `h` function? maybe the jsx pragma
> comment?

> We've made sense of much more complicated mutually conflicting standards
> problems before... we just declare stuff to not work anymore... like marquee
> tag... and if it does not make sense sometime, we put in feature flags, or
> `use jsx` language pragma? maybe `use jsx 1.0`, `use jsx 2.0` ?

------
duskwuff
Mozilla actually had something similar to JSX at one point:

[https://developer.mozilla.org/en-
US/docs/Archive/Web/E4X](https://developer.mozilla.org/en-
US/docs/Archive/Web/E4X)

~~~
osdevisnot
JSX sure has some overlap with E4X, however, JSX has no relation to the E4X
specification:

[https://facebook.github.io/jsx/#prior-
art](https://facebook.github.io/jsx/#prior-art)

