On 3/1/06, Michael Stuhr <[EMAIL PROTECTED]> wrote:
> A/MMC does not warn before using this:
>
> var o = new Object();
> o.arguments [1, 2, 3];
>
> is this a statement or what ? and if so, what does it do, all i could see is
> undefined / null / not there
>
>
> fun to find this one in a ~10000 lines project.
>
>
So...technically that is legal, though I don't know why anyone would do that.
First of all, you can put a constant on a line by itself, and it just
does nothing:
3; // this is legal in AS
myObj.blah[3] // this is also legal
Secondly, there is the syntax ([expr1],[expr2],...,[exprN]), which
will execute all the expressions, and return the result of exprN.
so:
(1,2,3)
is the same as:
function blah()
{
1; // legal, as per above.
2;
return 3;
}
blah();
Finally, your statement combines the two principles:
o.arguments[1,2,3];
is the same as :
o.arguments[ (1,2,3) ];
compiles to:
1;
2;
o.arguments[3];
which are 3 legal commands, but they don't do anything.
Hope this helps your understanding a bit. But I agree, MMC should
definately have a 'strict compile' mode that warns when you do weird
things like that. AS3 probably would complain (maybe not though?)
-David R
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com