flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Mclean <jus...@classsoftware.com>
Subject Re: git commit: [flex-asjs] [refs/heads/tlf] - Reverted strict equality
Date Sat, 24 Jun 2017 23:28:09 GMT

> undefined can be a functional change to ActionScript code when adding to numbers and
> var obj:Foo;
> trace(1 + undefined); NaN
> trace("hello " + undefined); //hello undefined
> trace(1 + obj); //1
> trace("hello " + obj); //hello null
> trace(1 + null); //1
> trace("hello " + null); //hello null

So currently that produces a different result when cross compiled to JS.

hello undefined
hello undefined
hello null

Wouldn’t you consider that a bug? How often would this occur in the real world and would
it matter I’m not 100% sure.

> However, I'm actually not sure that initializing Numbers is necessary. Leaving it as
undefined is generally functionally equivalent to NaN:
> isNaN(undefined) //true
> isNaN(null) //false

It increased performance by around 5% in our applciation so in my books that’s reason enough
to do it

> But initializing ints to null will generally get the same result as initializing them
to 0…

Currently int's are initialised to 0 no one has suggested setting them to null.


View raw message