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][FALCONJX] The Date class
Date Tue, 23 Feb 2016 20:53:44 GMT
A warning for Array.sort() might be the right answer, although I would be
tempted to cross-compile it to something like Array.ActionScriptSort() and
actually implement what it does in AS.

For Date, I think folks will expect properties like .hour to work.  The
feedback I think I'm hearing is that folks want the lowest barrier to
migration that we can give them.  We may never get it to zero, but every
time they have to change their code it gives them a reason to consider
other frameworks.

Another option that doesn't involve compiler changes is that we create a
bead that adds the getters and setters to Date so folks can opt-in.  I
don't think I want to try to override Array.sort, so I'd still have
cross-compiler generate a call to a differently named function.

-Alex

On 2/23/16, 11:44 AM, "Peter Ent" <pent@adobe.com> wrote:

>I have to agree with Andy about issuing warnings.
>
>We could make Date an exception and the compiler sees .hour and translates
>that to .getHours() for the JS code as Alex suggests. That seems like its
>pretty straightforward but anything not as obvious just get flagged.
>
>My 2 cents,
>Peter Ent
>Adobe Systems/Apache Flex Project
>
>On 2/23/16, 1:44 PM, "Andy Dufilie" <andy.dufilie@gmail.com> wrote:
>
>>AS has getHours() and setHours() too.  If the code is updated to use
>>those
>>it should work.
>>Date is not the only class that has differences - Array.sort() is not the
>>same in AS and JS.
>>I think the most the compiler should do is provide a warning when using
>>known AS features that do not exist in JS, because some things can't
>>easily
>>be translated.
>>
>>Andy
>>
>>On Tue, Feb 23, 2016 at 12:16 PM, Alex Harui <aharui@adobe.com> wrote:
>>
>>> Hi,
>>>
>>> This bug [1] is about the Date class.
>>>
>>> It appears that JS uses, for example, getHour()/setHour() while AS uses
>>> the .hour property.  How should we handle this?  Some options are:
>>>
>>> 1) Use Object.defineProperties to add get/set to Date
>>> 2) Have the compiler detect Date and generate getHour/setHour calls.
>>>
>>> Thoughts?
>>> -Alex
>>>
>>> [1] https://issues.apache.org/jira/browse/FLEX-35041
>>>
>>>
>

Mime
View raw message