OZONE Asylum
Forums
DHTML/Javascript
20 Liners - January 08 - Dynamics
This page's ID:
29836
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
[quote]It completely does instead : it simply is a conditional operator like "for, if" and the likes - what's that to say? That if an elsesection is never to be executed "just because", the content of the mentioned section should not count as part of the code. [/quote] Well, there's a slight difference there: [code]if(expr) stmt1; else stmt2;[/code] I'd say [i]expr[/i], [i]stmt1[/i], [i]stmt2[/i] are what counts. Count whatever code is actually executable. In [code]try{ stmt1; stmt2; }catch(e){ stmt3; }finally{ stmt4; }[/code]I think [i]stmt1[/i], [i]stmt2[/i], [i]stmt3[/i], [i]stmt4[/i] are what counts, because they are what code is actually executable. In short, no, a path that is not taken is still counted. However, a path counts for the number of executable things in that path, not for the peripheral syntax. Another point, regarding poi's example:[code]/* A */ for( chainThat in {methodA:1,methodB:1} ) /* */ { /* B */ anObject.prototype[chainThat] = function( func ) /* */ { /* C */ return function() /* */ { /* D */ return func.apply( this, arguments )||this; /* */ } /* E */ }( anObject.prototype[chainThat] ); /* */ }[/code] The lines I think should count are: [code]1: for( chainThat in {methodA:1,methodB:1} ) 2: anObject.prototype[chainThat] = function( func ) {...} ( anObject.prototype[chainThat] ); 3: return function() {...} 4: return func.apply( this, arguments )||this;[/code]because B and E are a declaration-application pair, in one single expression, that is not a list expression. To illustrate what I mean better, consider the line count if it was split out to a separate declaration. The line count for that should be exactly equivalent to the line count for this:[code]/* */ function fn( func ) /* */ { /* C */ return function() /* */ { /* D */ return func.apply( this, arguments )||this; /* */ } /* */ } /* A */ for( chainThat in {methodA:1,methodB:1} ) /* */ { /* B */ anObject.prototype[chainThat] = /* E */ fn( anObject.prototype[chainThat] ); /* */ }[/code] But then again, I've not participated in a 20 liner yet, so count my opinion for what that's worth to you... -- var Liorean = { abode: "[sigrotate][url]http://liorean.web-graphics.com/[/url]|[url]http://codingforums.com/[/url]|[url]http://web-graphics.com/[/url][/sigrotate]", profile: "[url]http://codingforums.com/member.php?u=5798[/url]"}; [small](Edited by [url=http://www.ozoneasylum.com/user/5032]liorean[/url] on 01-22-2008 23:57)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »