JavaScript once had a JSX-like syntax called E4X
developer.mozilla.org
developer.mozilla.org
https://www.schneier.com/blog/archives/2013/10/how_the_nsa_a...
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.
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.
"Everything old becomes new again."
Sad to see that all these great and convenient language features will take years (or never) to reach JS now that we voluntarily handcuffed ourselves to standards based tech just to satisfy the vendetta of a dead man.
But at least Flash is dead, right?
var val : String = "foo";
var foo : XML = <foo><bar prop={val} /></foo>;
...and it worked. I swear this wasn't documented anywhere. That said, I just googled a few Flex examples (I never used Flex) and it seems to be common there, so I guess that explains why at least someone knew it existed!The formal language specification came fairly late in AS3's useful life, but it also describes the syntax: http://help.adobe.com/livedocs/specs/actionscript/3/as3_spec...
I don't know if this would've been a super useful feature for me a decade ago, but it's nice to know it was there anyway.
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.
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?
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 = <span style = "font-face:custom; font-weight:bold" />;
.... <wordmark>hello</wordmark>6 years ago I wrote a proof of concept to replace a large Rails application in pure JS using prototypes and constructing the html from strings. The latter turned out to be the most messy part so I stopped that and rather refactored the legacy Rails code to do something useful.
Could be really great for super lightweight JS apps!
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
if would mean that jsx would look something like
function helloEl() {return jsx <div> Hello ${name}! </div>}
as opposed to function helloEl() {return <div> Hello {name}! </div>}
It would be a bit different though in what is actually going on though. The top example would just desugar to jsx.div(`Hello ${name}`)
jsx would be looked up like any other variable. So you could just define it in global scope to point to ReactDOM1: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
JSX is more about XML as a development syntax, which makes more sense.
I was at their launch at ETech in like 2005?
Or, JSX is so backward, behind its time?