Live data from Hacker News

JavaScript once had a JSX-like syntax called E4X

developer.mozilla.org

41–50 of 50 posts

Re: JavaScript once had a JSX-like syntax called E4X

#41
post #24
post #6

E4X was part of Actionscript 3. It was very nice.

It was also widely used for Adobe Flex for making Flash interfaces. "Everything old becomes new again."

I quite loved my small stint developing in Adobe flex. I have to admit it.

Re: JavaScript once had a JSX-like syntax called E4X

#42
Fb says:

Prior Art # The JSX syntax is similar to the E4X Specification (ECMA-357). E4X is a deprecated specification with deep reaching semantic meaning. JSX partially overlaps with a tiny subset of the E4X syntax. However, JSX has no relation to the E4X specification.

Re: JavaScript once had a JSX-like syntax called E4X

#43
post #11

Earlier quoted context omitted.

How would that work in practice, though? Using Babel JSX gets compiled to React.createElement('div', null, {}). You can configure babel to output something else if you use something other than React. So what would a standardized JSX syntax output? It can't be document.createElement since that is a web API and not a generic JS API. So what would it do, exactly?

I've written an in depth blog post on "generic jsx", which turns JSX into function bind/currying syntax that would work fine in any framework (or not framework at all, as we currently use it). http://tolmasky.com/2016/03/24/generalizing-jsx/ We use this generic-jsx in DemoKit: https://github.com/runkitdev/demokit , and it's really cool because you can do fancy stuff like: // Curry your JSX tags! const wordmark = ; ..…

Its also important to consider the environment as well since JSX is potentially much bigger than the web.

JSX is much like other generic user interface markup languages[0] and like many other is simply a dialect of XML. Any interface that can be represented with XML/HTML or any other markup language can use JSX and optionally react. We are already seeing this boom with in native mobile environments with React Native, NativeScript, Titanium...

Here are several examples where JSX is used that is not a browser:

- Native desktop apps for Linux, Mac, and Windows (Not including Electron/NW.js)[1][2][3][4]

- TVs with AppleTV apps or Netflix's Gibbon[5][6]

- Command line apps as stdin/stdout with react-blessed[7]/mylittledom[8]

- Direct to Canvas[9]/pixi.js[10]

- Latex documents[11]

- Web Audio[12]

- Conole.logs[13]

- Truly custom direct to hardware[14] as some C code like: `digitalWrite(led, HIGH)`

I definitely believe JSX could use standardization separate from any implementation, JavaScript or otherwise.

[0]: https://en.wikipedia.org/wiki/User_interface_markup_language

[1]: https://github.com/sidorares/react-x11

[2]: https://github.com/grassator/react-qml

[3]: https://github.com/ptmt/react-native-macos

[4]: https://github.com/Microsoft/react-native-windows

[5]: https://github.com/ramitos/react-tvml

[6]: https://www.youtube.com/watch?v=eNC0mRYGWgc

[7]: https://github.com/Yomguithereal/react-blessed

[8]: https://github.com/manaflair/mylittledom

[9]: https://github.com/Flipboard/react-canvas

[10]: https://github.com/Izzimach/react-pixi

[11]: https://github.com/vzaccaria/jsx-latex

[12]: https://github.com/FormidableLabs/react-music

[13]: https://github.com/mohebifar/konsul

[14]: https://github.com/iamdustan/react-hardware

Re: JavaScript once had a JSX-like syntax called E4X

#44
post #11
post #8

Would be nice to see JSX syntax become standardized. Clearly lots of people like it.

How would that work in practice, though? Using Babel JSX gets compiled to React.createElement('div', null, {}). You can configure babel to output something else if you use something other than React. So what would a standardized JSX syntax output? It can't be document.createElement since that is a web API and not a generic JS API. So what would it do, exactly?

You can already translate JSX to `document.createElement` with babel. I haven't seen one, but I wouldn't doubt a `customElements.define` translation is coming as well.

Re: JavaScript once had a JSX-like syntax called E4X

#46
post #24

Earlier quoted context omitted.

It was also widely used for Adobe Flex for making Flash interfaces. "Everything old becomes new again."

I quite loved my small stint developing in Adobe flex. I have to admit it.

I share that sentiment. The complete decoupling of UI presentation and logic all the way up to and through asset deployment via Flex Skins was interesting and had a lot of potential.

Re: JavaScript once had a JSX-like syntax called E4X

#47
post #23

One bit of E4X trivia: a bug in the Firefox E4X implementation was taken advantage of by an exploit called "EgotisticalGiraffe", according to the Snowden documents. The implementation of E4X in Firefox was large and complex. https://www.schneier.com/blog/archives/2013/10/how_the_nsa_a...

Related: http://mozillamemes.tumblr.com/post/20381316930/inspired-by-... http://mozillamemes.tumblr.com/post/22247147806/desperate-ti... http://mozillamemes.tumblr.com/post/19721622462/no-matter-ho...

Re: JavaScript once had a JSX-like syntax called E4X

#48
post #4

I wonder what made JSX seem like a good idea then.

Don't know why this got downvoted. If a standard feature of JavaScript got no love because "XML sucks", then later becomes popular as part of a proprietary lib, this very much questions rationality and taste in JavaScript evolution.

Re: JavaScript once had a JSX-like syntax called E4X

#49

In 2008 I built a production website in Helma (server side JavaScript framework running on Rhino, JS on the JVM) with E4X for the view. You could say I've been waiting for React for a long time. Also that I used way-too-niche technology for a one-off project. :-/

Avantgarde rather than niche I'd say. Helma, v8cgi and co. pioneered server-side JavaScript and around 2010 inspired CommonJS for portability, which Node.js became the dominant implementation of. I believe Netscape's original web server product featured JavaScript as server-side scripting language back in 1995/6 already.

And the TU-Graz Hyper-G system => Hyperwave, which was very popular in the early internet days. It preceded WWW and Netscape by a bit.

Re: JavaScript once had a JSX-like syntax called E4X

#50

Earlier quoted context omitted.

That's possibly why I knew about it then (for a brief period, I did Flex work ten years ago).

I used to do Flex a long time ago, and I love how the frontend dev world is finally catching up to Flash from the late naughties.

Flash won. The world of Internet development is slowly being remade in Flex's image.

That Adobe abandoned he technology rather that retooling it to target HTML5 is a strategic blunder up there with... I can't actually work out an equivalent.

Post reply on HN