title: JSLint complains about function expression namespace syntax
body: <p>Alright, I know what's the difference between a <strong><code>FunctionDeclaration</code></strong> and a <strong><code>FunctionExpression</code></strong>. @<a href="https://stackoverflow.com/users/5445/cms" title="User CMS - Stack Overflow">CMS</a> did a <a href="https://stackoverflow.com/questions/1634268/explain-javascripts-encapsulated-anonymous-function-syntax/1634321#1634321" title="Explain JavaScript&#39;s encapsulated anonymous function syntax - Stack Overflow">great job</a> of explaining that. Till recently, I used to use the same syntax for creating <strong>lambda expressions</strong> and <strong>namespaces</strong> following <a href="http://www.crockford.com/" rel="nofollow noreferrer" title="Douglas Crockford&#39;s Wrrrld Wide Web">Douglas Crockford's</a> example:</p>
  
  <pre><code>(function () {
      "use strict";
  }());
  </code></pre>
  
  <p>He justifies this <a href="http://javascript.crockford.com/code.html" rel="nofollow noreferrer" title="Code Conventions for the JavaScript Programming Language">convention</a> as follows:</p>
  
  <blockquote>
    <p>When a function is to be invoked immediately, the entire invocation expression should be wrapped in parens so that it is clear that <strong>the value being produced</strong> is the result of the function and not the function itself.</p>
  </blockquote>
  
  <p>This syntax is great for <strong>lambda expressions</strong> because they return a value. However, <strong>namespaces</strong> do not return a value. Hence I now prefer using the following syntax for <strong>namespaces</strong> instead (taken from the <a href="http://bonsaiden.github.com/JavaScript-Garden/" rel="nofollow noreferrer" title="JavaScript Garden">JavaScript Garden</a>):</p>
  
  <pre><code>(function () {
      "use strict";
  })();
  </code></pre>
  
  <p>The rationale behind the use of this syntax is given as follows:</p>
  
  <pre><code>( // evaluate the function inside the paranthesis
  function() {}
  ) // and return the function object
  () // call the result of the evaluation
  </code></pre>
  
  <p>Using this syntax for <strong>namespaces</strong> makes more sense to me because: this syntax separates the <strong>namespace</strong> and the invocation; and <a href="http://www.crockford.com/" rel="nofollow noreferrer" title="Douglas Crockford&#39;s Wrrrld Wide Web">Douglas Crockford's</a> syntax expects the function to return a value.</p>
  
  <p>However, when I pass this syntax through <a href="http://www.jslint.com/" rel="nofollow noreferrer" title="JSLint, The JavaScript Code Quality Tool">JSLint</a> I get the an error stating "<code>Move the invocation into the parens that contain the function.</code>". I don't understand why it complains about this syntax. It's a widely used and accepted syntax.</p>
  
  <p>I plan on notifying <a href="http://www.crockford.com/" rel="nofollow noreferrer" title="Douglas Crockford&#39;s Wrrrld Wide Web">Douglas Crockford</a> about this problem. However, before I do so I would appreciate any feedback you may provide. Perhaps it's better to simply stick with his syntax? Please explain your views.</p>