You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by lizhi <sl...@qq.com> on 2016/07/01 02:43:56 UTC

flexjs init the int =0

as3 code
var i:int
the (i=0)

but js code

var i;
the(i = NaN)

so good js code is var i =0;



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-0-tp53569.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: flexjs init the int =0

Posted by Harbs <ha...@gmail.com>.
We had a discussion a few months back entitled "[FlexJS]as in”. There were a number of suggestions how to handle int, but I don’t think anyone did anything there.

On Jul 3, 2016, at 9:49 AM, Alex Harui <ah...@adobe.com> wrote:

> 
> 
> On 7/1/16, 1:44 PM, "jude" <fl...@gmail.com> wrote:
> 
>> ihzi is correct. to clarify, the compiler should initialize integers to
>> zero when they are defined. and it should probably wrap any code that
>> assigns a value to an int with parseInt().
> 
> IMO, it should be easy to initialize integers to zero, but I'm concerned
> about the overhead of having to do all of the automatic type conversions
> that AS does and JS doesn't, so injecting code like parseInt will probably
> have to wait.
> 
> -Alex
> 


Re: flexjs init the int =0

Posted by jude <fl...@gmail.com>.
in as3 if you sign an object to an int an error is thrown. in js the
variable would be assigned to the object and would no longer be an int. so
maybe, when the time comes, simply casting it as int would be enough.
On Jul 3, 2016 1:50 AM, "Alex Harui" <ah...@adobe.com> wrote:

>
>
> On 7/1/16, 1:44 PM, "jude" <fl...@gmail.com> wrote:
>
> >ihzi is correct. to clarify, the compiler should initialize integers to
> >zero when they are defined. and it should probably wrap any code that
> >assigns a value to an int with parseInt().
>
> IMO, it should be easy to initialize integers to zero, but I'm concerned
> about the overhead of having to do all of the automatic type conversions
> that AS does and JS doesn't, so injecting code like parseInt will probably
> have to wait.
>
> -Alex
>
>

Re: flexjs init the int =0

Posted by Alex Harui <ah...@adobe.com>.

On 7/1/16, 1:44 PM, "jude" <fl...@gmail.com> wrote:

>ihzi is correct. to clarify, the compiler should initialize integers to
>zero when they are defined. and it should probably wrap any code that
>assigns a value to an int with parseInt().

IMO, it should be easy to initialize integers to zero, but I'm concerned
about the overhead of having to do all of the automatic type conversions
that AS does and JS doesn't, so injecting code like parseInt will probably
have to wait.

-Alex


Re: flexjs init the int =0

Posted by jude <fl...@gmail.com>.
ihzi is correct. to clarify, the compiler should initialize integers to
zero when they are defined. and it should probably wrap any code that
assigns a value to an int with parseInt().

On Jul 1, 2016 3:38 PM, "jude" <fl...@gmail.com> wrote:
>
> in as3
>
> var i:int; // i equals 0
>
> in JavaScript i is undefined because we don't know what type it is
>
> var i; // null, undefined or NaN
>
> therefore we need to initialize every integer as zero when it's defined.
>
> On Jun 30, 2016 10:35 PM, "lizhi" <sl...@qq.com> wrote:
>>
>> and i++ in as i=1
>> but js i= NaN
>>
>>
>>
>> --
>> View this message in context:
http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-0-tp53569p53570.html
>> Sent from the Apache Flex Development mailing list archive at Nabble.com.

RE: [Non-DoD Source] RE: flexjs init the int =0

Posted by Kessler CTR Mark J <ma...@usmc.mil>.
Forgot about that.  I'm just used to always initializing my ints/numbers to 0 or -1.


-----Original Message-----
From: Josh Tynjala [mailto:joshtynjala@gmail.com]
Sent: Tuesday, July 05, 2016 8:10 AM
To: dev@flex.apache.org
Subject: [Non-DoD Source] RE: flexjs init the int =0

A Number initializes to NaN in the Flash runtimes, if you don't set it to
anything else.

- Josh
On Jul 5, 2016 3:07 AM, "Kessler CTR Mark J" <ma...@usmc.mil>
wrote:

RE: flexjs init the int =0

Posted by Josh Tynjala <jo...@gmail.com>.
A Number initializes to NaN in the Flash runtimes, if you don't set it to
anything else.

- Josh
On Jul 5, 2016 3:07 AM, "Kessler CTR Mark J" <ma...@usmc.mil>
wrote:

> Number?
>
>
> -Mark
>
>
> -----Original Message-----
> From: Alex Harui [mailto:aharui@adobe.com]
> Sent: Friday, July 01, 2016 7:46 PM
> To: dev@flex.apache.org
> Subject: Re: flexjs init the int =0
>
> Yep.  Looking into it.  Are there any other types other than int and uint
> that will need initialization?
>
> -Alex
>
> On 7/1/16, 1:38 PM, "jude" <fl...@gmail.com> wrote:
>
> >in as3
> >
> >var i:int; // i equals 0
> >
> >in JavaScript i is undefined because we don't know what type it is
> >
> >var i; // null, undefined or NaN
> >
> >therefore we need to initialize every integer as zero when it's defined.
> >On Jun 30, 2016 10:35 PM, "lizhi" <sl...@qq.com> wrote:
> >
> >> and i++ in as i=1
> >> but js i= NaN
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> >>
> http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-
> >>0-tp53569p53570.html
> >> Sent from the Apache Flex Development mailing list archive at
> >>Nabble.com.
> >>
>
>

RE: flexjs init the int =0

Posted by Kessler CTR Mark J <ma...@usmc.mil>.
Number?
 

-Mark


-----Original Message-----
From: Alex Harui [mailto:aharui@adobe.com] 
Sent: Friday, July 01, 2016 7:46 PM
To: dev@flex.apache.org
Subject: Re: flexjs init the int =0

Yep.  Looking into it.  Are there any other types other than int and uint
that will need initialization?

-Alex

On 7/1/16, 1:38 PM, "jude" <fl...@gmail.com> wrote:

>in as3
>
>var i:int; // i equals 0
>
>in JavaScript i is undefined because we don't know what type it is
>
>var i; // null, undefined or NaN
>
>therefore we need to initialize every integer as zero when it's defined.
>On Jun 30, 2016 10:35 PM, "lizhi" <sl...@qq.com> wrote:
>
>> and i++ in as i=1
>> but js i= NaN
>>
>>
>>
>> --
>> View this message in context:
>> 
>>http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-
>>0-tp53569p53570.html
>> Sent from the Apache Flex Development mailing list archive at
>>Nabble.com.
>>


Re: flexjs init the int =0

Posted by Alex Harui <ah...@adobe.com>.
Yep.  Looking into it.  Are there any other types other than int and uint
that will need initialization?

-Alex

On 7/1/16, 1:38 PM, "jude" <fl...@gmail.com> wrote:

>in as3
>
>var i:int; // i equals 0
>
>in JavaScript i is undefined because we don't know what type it is
>
>var i; // null, undefined or NaN
>
>therefore we need to initialize every integer as zero when it's defined.
>On Jun 30, 2016 10:35 PM, "lizhi" <sl...@qq.com> wrote:
>
>> and i++ in as i=1
>> but js i= NaN
>>
>>
>>
>> --
>> View this message in context:
>> 
>>http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-
>>0-tp53569p53570.html
>> Sent from the Apache Flex Development mailing list archive at
>>Nabble.com.
>>


Re: flexjs init the int =0

Posted by jude <fl...@gmail.com>.
in as3

var i:int; // i equals 0

in JavaScript i is undefined because we don't know what type it is

var i; // null, undefined or NaN

therefore we need to initialize every integer as zero when it's defined.
On Jun 30, 2016 10:35 PM, "lizhi" <sl...@qq.com> wrote:

> and i++ in as i=1
> but js i= NaN
>
>
>
> --
> View this message in context:
> http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-0-tp53569p53570.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Re: flexjs init the int =0

Posted by lizhi <sl...@qq.com>.
and i++ in as i=1
but js i= NaN



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/flexjs-init-the-int-0-tp53569p53570.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.