Loading ...
Sorry, an error occurred while loading the content.

1615Re: [jslint] Re: Filtered for...in

Expand Messages
  • Cheney, Edward A SSG RES USAR USARC
    Nov 18, 2010
    • 0 Attachment
      Erik,

      The problem with the continue statement is that its use obscures logic. It is clear that a loop will break or it is endless. An endless loop is considered a broken program. Since a correct loop will end what is important is if it ends at the defined point of termination or if the loop ends prematurely. The continue statement does nothing to make this more clear and instead confuses the interpretation of potential break points. The break statement, conversely, is absolutely imperative to this clarity. Premature loop termination is absolutely essential to certain operations where the variable representing the looping index is used in closure, because then that variable can be used against the stated loop length to derive conditional conclusions outside of a containing function.

      In other words the continue statement can always be mitigated through the use of more sturdy logic while its use can confuse other logic that is essential not open to mitigation. Therefore, it is in your best interest to not use the continue statement. Additionally, if you are assigning a variable set in closure representing any of the three object types in a condition containing a continue statement you are likely opening a covert channel in your code, which is a potential security weakness if your code is complex enough to contain multiple points of disparate execution.

      If you post an example of JavaScript using the continue statement I can show how to mitigate its use.

      Austin Cheney, CISSP
      http://prettydiff.com/
    • Show all 19 messages in this topic