Live data from Hacker News

JavaScript once had a JSX-like syntax called E4X

developer.mozilla.org

31–40 of 50 posts

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

#31

Earlier quoted context omitted.

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!

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.

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

#32

Earlier 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!

It's documented. I used to be very fluent in the AS3LR, and I found it in a minute or two here: http://help.adobe.com/en_US/FlashPlatform/reference/actionsc...

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...

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

#33

Anyone remember Yahoo Pipes? I wrote some flows at some point and used E4X. It was fun.

So far ahead of its' time. I was at their launch at ETech in like 2005?

> So far ahead of its' time

Or, JSX is so backward, behind its time?

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

#34
Yes, this was back when the web was all crazy about XML as a data transfer format (redundancies and all). The goal of E4X was to make that data format easier to work with. JSON spelled the end of that.

JSX is more about XML as a development syntax, which makes more sense.

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

#36

If you've ever used Mirth[1] then you've used E4X, for better or worse (usually the latter). It's still used very heavily inside of the transformers, even though Mozilla deprecated it years ago. [1] https://www.mirth.com/

Haha came to the comments looking for this. Mirth is love, Mirth is life.

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

#37
post #35
post #24

Earlier quoted context omitted.

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

You're thinking of MXML. Different thing.

Nope. E4X was inline XML and it has been in AS3 for many many years.

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?

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

#38
post #32

Earlier quoted context omitted.

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!

It's documented. I used to be very fluent in the AS3LR, and I found it in a minute or two here: http://help.adobe.com/en_US/FlashPlatform/reference/actionsc... 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...

Ah, thank you for these. I skimmed the documentation about AS3's XML support and didn't see it there, and I'm not sure "operators" would be a place I would've looked!

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.

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

#39
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...

[deleted]

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

#40
post #37
post #35

Earlier quoted context omitted.

You're thinking of MXML. Different thing.

Nope. E4X was inline XML and it has been in AS3 for many many years. 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?

The post you're responding to was talking about the markup language used for Flex, which was MXML, not E4X.
Post reply on HN