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."
JavaScript once had a JSX-like syntax called E4X
41–50 of 50 posts
Re: JavaScript once had a JSX-like syntax called E4X
#42Prior 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
#43Earlier 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 = ; ..…
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
Re: JavaScript once had a JSX-like syntax called E4X
#44Would 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?
Re: JavaScript once had a JSX-like syntax called E4X
#45Re: JavaScript once had a JSX-like syntax called E4X
#46Earlier 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.
Re: JavaScript once had a JSX-like syntax called E4X
#47One 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...
Re: JavaScript once had a JSX-like syntax called E4X
#48I wonder what made JSX seem like a good idea then.
Re: JavaScript once had a JSX-like syntax called E4X
#49In 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.
Re: JavaScript once had a JSX-like syntax called E4X
#50Earlier 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.
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.