fwiw, i dont think it's a matter of "world view" is it not a matter of their syntax being legal javascript or not?
in case anyone reading this doesn't understand Automatic Semicolon Insertion (ASI), go read http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding which is extremely enlightening (function() { console.log('legal') })() is perfectly fine, however if you concat that file back to back, you'll have an error: (function() { console.log('legal') })() (function() { console.log('will not print') })() so if you're compressing to one file, and your stuff is the second closure, your stuff wont load. you could edit their file to add a ; at the end but assuming their file is some sort of library you find useful, every time you have to upgrade it, you have to add that semicolon or you could code defensively (like driving, there are too many idiots on the road), and just add the semi at the beginning of your file. partly the same idea as mootools' use of (function() { var typeOf = this.typeOf = function() {....} })(); inside that closure, other methods will reference typeOf, which will reference the closure version of that function and prevent trampling of it by other scripts, ensuring it always uses the right one. if you drive 20 over all the time, go ahead and edit that library you're including, or if you're like me and drive only 5 over most of the time, and prefer not to die in my car, just bite the bullet and tack that semicolon at the beginning of your file. I'll have my beer now ;) On May 18, 12:22 pm, Ger Hobbelt <[email protected]> wrote: > [Removed original response. TL;DR. Thanks for the 'circular?' remark > arriving here while I was writing that one. Let's make it a single line.] > > > You have to force the function to be an expression somehow, you can't just > > "not do it at all" or else you'll get a parse error. > > As we are discussing two issues at the same time in this thread by now, my > point was that you fix the latter, which is missing semicolons in 'theirs', > by fixing 'them', while I implicitly skipped over the former issue (mea > culpa), which considered variable scoping as I believe everyone here is of a > single vision there and which is handled in my perspective by the same > 'cleanliness' argument by adhering to 'doing unto others what you want done > unto you', i.e. you use a closure to wrap yours, while being attentive using > 'var', which is where JSLint can be very handy as an aid. > > For the rest it's simply a matter of 'world view'. What I referred to as > 'religion'. When you read my first message, you'll see how and what I do to > counter the parse error. In my mind, I keep my analogy of the doormat where > folks wipe their feet when they enter my house, in the front porch. The > house itself starts after the porch ('vestibule') doors. Welcome to /my/ > garbage. How was yours? :-) Wanna beer? > > On Wed, May 18, 2011 at 5:45 PM, אריה גלזר <[email protected]> wrote: > > > is this not becoming circular by now? > > Yup. > > -- > Met vriendelijke groeten / Best regards, > > Ger Hobbelt > > -------------------------------------------------- > web: http://www.hobbelt.com/ > http://www.hebbut.net/ > mail: [email protected] > mobile: +31-6-11 120 978 > --------------------------------------------------
