E4X in ActionScript

Posted by Brian Genisio on Stack Overflow See other posts from Stack Overflow or by Brian Genisio
Published on 2010-12-22T11:04:51Z Indexed on 2010/12/22 13:54 UTC
Read the original article Hit count: 278

Filed under:

Hey all,

Looking at the E4X implementation in ActionScript, it occurs to me that they had to figure out how to do three things that I am not sure can be done within ActionScript regularly:

Properties/Getters prefixed with @: var myAttribute = xmlPerson.@name;

Nameless functions for filtering: xmlData.person.(/* predicate */)

lambda syntax for predicates: xmlData.person.(@name == "Brian")

So here is my question: Are these just one-off capabilities (much like Vector.<>) they put in just for E4X, therefore keeping out of reach for us? Or do we, as ActionScript developers, have access to these features?

More specifically, I'd love to get access to the expression tree of that lambda predicate for my own code (not tied to the XML classes in any way).

I figured out that this is called the "filter operator"... but I am not sure how to harness it. Not sure I can... since ActionScript does not allow for operator overloading :(

© Stack Overflow or respective owner

Related posts about actionscript-3