for(var i:int = 0; i != 5; i++){do_something(i);}for(var i:int = 0; i != 7; i++){do_something_else(i);}
throws a compiler warning for duplicated variables, but ALSO,
do_something(i);var i:int = 4;
does not throw a compiler warning, since 'i' is defined in the function scope. This can lead to unexpected behavior.
In porting from Java, one of the most irritating non-regular expressionable tasks is finding all the duplicate variable definitions and moving them to the beggining of the function, because AS3 doesn't respect block scoping.
AS3 is a huge step up from AS2, and there's a lot I like about it, but this omission is really glaring, and frankly amatuerish.
No comments:
Post a Comment