That's the real source of sloppiness, Java has eliminitaed these
discussions by the simple expeditent of requiring that the conditional
resolves to a boolean, nothing wlse will do. THe real question to me
is does AS3 change this behavior?
On 7/27/06, ryanm <[EMAIL PROTECTED]> wrote:
> To me it has always seemed more logical to use if this.length == 0 for the
> very reason of explicitness that you stated; and thus, using the
> alternative !this.length was less enticing. I speculated (wrongly) after
> reading your post that there might be some sort of speed optimization
> inherent to checking if something is false than actually checking for a
> specific length defined explicitly in your code. I don't know why I
> thought that, and obviously I am wrong for the various reasons stated
> earlier.
>
Further, !this.length is very likely slower. Conditions are meant to
resolve to a boolean, but the implicit cast is to a string, which means
walking the prototype to find the property, and if it exists (!=undefined),
casting it to a string, and then recasting it to a boolean. Meanwhile,
this.length==0 resolves directly to a boolean, and, as such, should be a bit
faster. It wouldn't be a noticable difference in speed in a single
condition, but in a recursive loop where it might be evaluated thousands of
times, it could make a significant difference.
ryanm
_______________________________________________
[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
--
Weldon MacDonald
_______________________________________________
[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