Hi, >> What is the point of initializing properties if there is a guarantee that >> they'll be initialized in other code before it is ever tested. Code like: >> >> var foo:String; >> if (someCondition) >> foo = "bar"; >> else >> foo = "foo”; > > Could be optimised away by the compiler.
And looks like this is currently likely. For instance this code: test = function() { var foo = 'hello'; var cond = true; if (cond) foo = 'bar'; else foo = 'foo'; console.log(foo); } test(); Gets optimised to: test=function(){console.log("bar")};test(); So there’s no cost in this case for the initial assignment and the variable doesn’t even exists in the final result. In more complex code you’ll probably get something different. Thanks, Justin