I know there are performance loses if开发者_StackOverflow社区 you don't specify variable types explicitly. Do ActionScript/Java developer in general prefer the use of the in classes or no?
public function hello():void
{
this.speaker.says("hello");
}
vs
speaker.says("hello")
There is no performance difference, it's just down to a matter of personal preference.
I prefer to use this.foo, personally. I sense I'm in the minority.
Just use the shorter form, there are no performance differences and the shorter form is generally preferred.
The only time it's really useful to use this
in AS3 could be, for example in a constructor where there may be some ambiguity between the method params and the instance params:
private var foo:String;
private var bar:String;
myClass( foo:String, bar:String ) {
this.foo = foo;
this.bar = bar;
}
But there is an issue of whether that is good programming style anyway.
精彩评论