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 type-checking. 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... [1]https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays On Nov 5, 2015, at 8:38 AM, Alex Harui <aha...@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 FalconJX > convert Vector calls to some new class like org.apache.flex.utils.Vector. > 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 mean > 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 type-checking. > > Thoughts? > -Alex > > > On 11/3/15, 8:13 AM, "Alex Harui" <aha...@adobe.com> wrote: > >> Added subject tag. >> >> Lizhi is correct. I don’t think we realized the Vector global function >> had different behavior than the Array global function. It opens a >> question about whether the compiler should generate the “correct” code or >> whether Vector should be implemented in the framework in a way that folks >> can swap in different Vector emulations. Some folks may want to pay the >> price of some type-checking. >> >> Figures this would come up after I posted an RC, but since lizhi knows how >> to work with nightly builds I think I want to see what else is found >> before the voting period is up before deciding whether to try to make a >> change for this release. IMO, it should wait for the next one because we >> should do the extra work of allowing swappable emulations, which would be >> rather risky for this release. >> >> Thoughts? >> -Alex >> >> On 11/3/15, 4:37 AM, "Harbs" <harbs.li...@gmail.com> wrote: >> >>> I think you need “new”… >>> >>> On Nov 3, 2015, at 9:55 AM, lizhi <s...@qq.com> wrote: >>> >>>> var vec:Vector.<Number> = Vector.<Number>([1, 2, 3]); >>>> alert(vec.length); >>>> I need 3,but get 0 >>>> >>>> >>>> >>>> >>>> ------------------ Original ------------------ >>>> From: "Alex Harui [via Apache Flex >>>> Development]"<ml-node+s2333347n4978...@n4.nabble.com>; >>>> Date: 2015年11月3日(星期二) 下午3:41 >>>> To: "lizhi"<s...@qq.com>; >>>> Subject: Re: vector error >>>> >>>> >>>> >>>> What output are you getting and what error occurs? >>>> >>>> -Alex >>>> >>>> On 11/2/15, 10:39 PM, "lizhi" <[hidden email]> wrote: >>>> >>>>> in as3. >>>>> new Vector.<*>([1,1,1]); >>>>> not the same Vector.<*>([1,1,1]); >>>>> >>>>> pls try >>>>> >>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> >>>>> http://apache-flex-development.2333347.n4.nabble.com/vector-error-tp497 >>>>> 7 >>>>> 2p >>>>> 49783.html >>>>> Sent from the Apache Flex Development mailing list archive at >>>>> Nabble.com. >>>> >>>> >>>> >>>> >>>> If you reply to this email, your message will be added to the >>>> discussion below: >>>> >>>> http://apache-flex-development.2333347.n4.nabble.com/vector-error-tp4977 >>>> 2 >>>> p49784.html >>>> To unsubscribe from vector error, click here. >>>> NAML >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> http://apache-flex-development.2333347.n4.nabble.com/vector-error-tp4977 >>>> 2 >>>> p49785.html >>>> Sent from the Apache Flex Development mailing list archive at >>>> Nabble.com. >>> >> >