incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Newman <Capta...@unFocus.com>
Subject Re: ABC -> JS
Date Thu, 06 Dec 2012 15:49:51 GMT
Maybe it's worth looking at a polyfill for defineProperties in IE8:

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperties
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys

I'm not sure how complete that is though. Does it emulate get/set? or 
would that require all AS3 classes are based off DOM elements (is that 
even viable)?

Kevin N.


On 12/6/12 7:32 AM, Frank Wienberg wrote:
> On Wed, Dec 5, 2012 at 11:39 PM, Kevin Newman <CaptainN@unfocus.com> wrote:
>
>> Object.create has other useful features too (that can't be polyfilled
>> unfortunately) - it has a way to set properties enumerable, configurable,
>> and writable and to define getters and setters. Having a mode to output to
>> that might be pretty spiffy.
>
> Yes, I'd even say that to simulate ActionScript semantics properly, we
> absolutely need Object.create() and/or Object.defineProperty().
> For example, in AS3, class members are not enumerable, but only expando
> properties are!
> Another example: by re-assigning the constructor property, the class
> simulation code above changes the usually non-enumerable "constructor" to
> be enumerable. So if you do a for... in loop over a class instance (in
> contrast to an Object), even if the class only defines public fields,
> "constructor" appears as an additional (unexpected!) key. This cannot
> easily be fixed by leaving out the "constructor" re-assignment: while this
> works for the first inheritance level, it starts failing with the second (I
> could explain that in detail upon request). Concluding, in ECMAScript 4,
> there is no solution for class simulation that does not "leak through" to
> pure JavaScript clients. To make ActionScript code behave the same, we
> would have to generate additional code for each and every for... in loop.
>
> I don't know what you think about IE8 compatibility, but considering that
> Flex is used for rather complex, rich UIs, not for simple web pages, we
> should think about the option of dropping IE8 support. Google did that for
> their rich web applications a while ago. It would allow to build an
> ECMAScript 6 runtime that would be very small and still offer a much
> closer, more efficient approximation of the original ActionScript 3
> semantics.
> But maybe this is another thread...
>


Mime
View raw message