E4X was part of Actionscript 3. It was very nice.
I always found it a little odd but quite pleasant - but I don't at all remember AS3's E4X having interpolation. Did I just never know about this feature (or have since forgotten - it's been, oh, half a decade at least since I've used ActionScript 3 in anger), or was it missing?
JavaScript once had a JSX-like syntax called E4X
21–30 of 50 posts
Re: JavaScript once had a JSX-like syntax called E4X
#22Earlier 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 = ; ..…
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!
Re: JavaScript once had a JSX-like syntax called E4X
#23https://www.schneier.com/blog/archives/2013/10/how_the_nsa_a...
Re: JavaScript once had a JSX-like syntax called E4X
#24E4X was part of Actionscript 3. It was very nice.
"Everything old becomes new again."
Re: JavaScript once had a JSX-like syntax called E4X
#25Would be nice to see JSX syntax become standardized. Clearly lots of people like it.
Re: JavaScript once had a JSX-like syntax called E4X
#26Earlier quoted context omitted.
I always found it a little odd but quite pleasant - but I don't at all remember AS3's E4X having interpolation. Did I just never know about this feature (or have since forgotten - it's been, oh, half a decade at least since I've used ActionScript 3 in anger), or was it missing?
It existed in AS3 too. Wasn't widely known to my knowledge though.
var val : String = "foo";
var foo : XML = ;
...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!Re: JavaScript once had a JSX-like syntax called E4X
#27In 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. :-/
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
#28Anyone remember Yahoo Pipes? I wrote some flows at some point and used E4X. It was fun.
I was at their launch at ETech in like 2005?
Re: JavaScript once had a JSX-like syntax called E4X
#29Re: JavaScript once had a JSX-like syntax called E4X
#30Earlier quoted context omitted.
It existed in AS3 too. Wasn't widely known to my knowledge though.
Thank you - confirmed. I just dug up a copy of Flash CS6 and tried this: var val : String = "foo"; var foo : XML = ; ...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!