flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FLEXJS] vector error
Date Thu, 05 Nov 2015 14:26:07 GMT

On 11/5/15, 12:10 AM, "Harbs" <harbs.lists@gmail.com> wrote:

>Considering the state of things, and the fact that we’re trying to get
>this version out the door, I think the quick-and-dirty approach makes
>sense for now. We can discuss further later.
>I don’t understand how you are proposing different implementations for

Fancier/alternative implementations of org.apache.flex.utils.Vector would
be in different SWCs and put in the lib-path before the default simple
one.  Those could do runtime checking or map things to Typed Arrays or

>As long as Flash is a valid target, I don’t see the type-checking as
>super important because theoretically, the type is checked at
>compile-time when targeting Flash. If there will be compiling exclusively
>to javascript, then type checking becomes a much bigger issue. To me, the
>whole purpose of using Vector when cross-compiling to js is type-checking
>since it’s being converted to Array no-matter. Otherwise, you might as
>well just use Array to start with. The only exception to this might be
>Vectors which map to Typed Arrays.[1] Not sure about this though...

I don’t think you always can compile-time check Vector usage.  You are
correct that that is why running a SWF version of your code is important
in the FlexJS workflow.  In theory more of your code is validated by the
Flash/AIR runtime.  But even then, there will be scenarios where you can
get data that should fail a runtime check only in your JS version.


>On Nov 5, 2015, at 8:38 AM, Alex Harui <aharui@adobe.com> wrote:
>> Wow.  It appears that Vector and Array support in Falcon has more holes
>> than I expected.
>> -The parameters to both “new Vector” and the Vector function are not
>> checked.
>> -The parameters to the Array function are not checked.
>> -FalconJX does not generate the right output for the Vector function.
>> IMO, the right way to support Vector in general would be to have
>> convert Vector calls to some new class like
>> Different implementations of FlexJSVector could add type-checking.  That
>> way folks can pay-as-you-go for the trade-off of type-checking vs
>> performance.  I’d rather not bake that into the compiler, but it does
>> one more class like org.apache.flex.utils.Language that is needed for
>> low-level JS apps.
>> I could try a simple implementation in the compiler for now.  I believe
>> the right JS output for:
>>    var a:Vector.<String> = Vector.<String>(someArrayOrVector);
>> would just be:
>>    var a = someArrayOrVector.slice();
>> because we are mapping Vector to Arrays that don’t have any
>> Thoughts?
>> -Alex

View raw message