On Jan 15, 2:30 pm, Bill Heaton <[email protected]> wrote: > I am curious if anyone can give me insight why the nesting of the function to > be immediately invoked should be completely contained within parenthesis ( // > func () ); versus parenthesis + parenthesis ( // func )(); > > I do not get why the parenthesis (and arguments if needed) would be better > placed just inside the final closing parenthesis ')'
This sounds like something that must have been recently added in the latest changes to JSLint. Crockford talks about his preference for this convention in the Yahoo video series "Crockford on Javascript" (volume three I believe). It is of course a matter of style, since the grouping operator is just there as a visual designation that the function self-executes, but Crockford stated something to the effect that it makes more sense for the entire self-executing function (including the actual invocation) to be enclosed within the grouping operator, than to leave the invocation out. One of the mentors can correct me if I'm wrong, but I don't think there's a technical advantage to either style. It seems to me that Crockford is adding more of his style conventions to the default JSLint config lately, and saying that if a developer doesn't like it, the various checks can be turned off. I've adopted this particular style in this case because it makes more sense to me too. - Joe Morgan -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
