Prev: Static Class Variables and IE8 Loosely Couple Internet Explorer(LCIE)
Next: IE versions of moz transform
From: JR on 10 Jan 2010 20:43 On Jan 10, 9:23 pm, "Michael Haufe (\"TNO\")" <t...(a)thenewobjective.com> wrote: > On Jan 10, 4:47 pm, Nik Coughlin <nrkn....(a)gmail.com> wrote: > > > Forget it, always use semicolons. Omitting them is bad practice. > > According to whom? Douglas Crockford has written about it: http://www.crockford.com/javascript/survey.html "Semicolon Insertion One of the mistakes in the language is semicolon insertion. This is a technique for making semicolons optional as statement terminators. It is reasonable for IDEs and shell programs to do semicolon insertion. It is not reasonable for the language definition to require compilers to do it. Use semicolons." -- JR
From: Nik Coughlin on 10 Jan 2010 21:33 On 11/01/2010 12:23 pm, Michael Haufe ("TNO") wrote: > On Jan 10, 4:47 pm, Nik Coughlin<nrkn....(a)gmail.com> wrote: >> Forget it, always use semicolons. Omitting them is bad practice. > > According to whom? According to common sense. They introduce needless ambiguity. What does this do? return { automaticSemicolons: "bad idea" };
From: "Michael Haufe ("TNO")" on 10 Jan 2010 23:34 On Jan 10, 8:33 pm, Nik Coughlin <nrkn....(a)gmail.com> wrote: > On 11/01/2010 12:23 pm, Michael Haufe ("TNO") wrote: > > > On Jan 10, 4:47 pm, Nik Coughlin<nrkn....(a)gmail.com> wrote: > >> Forget it, always use semicolons. Omitting them is bad practice. > > > According to whom? > > According to common sense. They introduce needless ambiguity. What does > this do? > > return > { > automaticSemicolons: "bad idea" > > > > > > }; > > The specification clearly defines this as dead code (ES5 7.9.1). Understanding the specification and the language eliminates such ignorance.
From: "Michael Haufe ("TNO")" on 10 Jan 2010 23:47 On Jan 10, 7:43 pm, JR <groups_j...(a)yahoo.com.br> wrote: > On Jan 10, 9:23 pm, "Michael Haufe (\"TNO\")" > > <t...(a)thenewobjective.com> wrote: > > On Jan 10, 4:47 pm, Nik Coughlin <nrkn....(a)gmail.com> wrote: > > > > Forget it, always use semicolons. Omitting them is bad practice. > > > According to whom? > > Douglas Crockford has written about it:http://www.crockford.com/javascript/survey.html > > "Semicolon Insertion > One of the mistakes in the language is semicolon insertion. This is a > technique for making semicolons optional as statement terminators. It > is reasonable for IDEs and shell programs to do semicolon insertion. > It is not reasonable for the language definition to require compilers > to do it. Use semicolons." > > -- > JR ASI is a convenience as mentioned in the ES5 spec. I would defer to Brendan Eich's statements on the subject in the following thread: http://www.mail-archive.com/es-discuss(a)mozilla.org/msg01609.html You want to use them? More power to you, but I for one don't prescribe to Crockford's opinion on this subject. I would argue it is more reasonable to put the burden on the compiler than the programmer.
From: Nik Coughlin on 11 Jan 2010 00:14
On 11/01/2010 5:34 pm, Michael Haufe ("TNO") wrote: > On Jan 10, 8:33 pm, Nik Coughlin<nrkn....(a)gmail.com> wrote: >> On 11/01/2010 12:23 pm, Michael Haufe ("TNO") wrote: >> >>> On Jan 10, 4:47 pm, Nik Coughlin<nrkn....(a)gmail.com> wrote: >>>> Forget it, always use semicolons. Omitting them is bad practice. >> >>> According to whom? >> >> According to common sense. They introduce needless ambiguity. What does >> this do? >> >> return >> { >> automaticSemicolons: "bad idea" >> }; >> >> > > The specification clearly defines this as dead code (ES5 7.9.1). > Understanding the specification and the language eliminates such > ignorance. It's an example of code that has a different effect to what most programmers would expect, not an incitement to write such code. There are plenty of other such cases. Regardless of one's knowledge of the language and the specification, anything that is as counter intuitive as the unintended effects of semicolon insertion is best avoided. Additionally there are exceptions where semicolons are not optional. So you introduce all of this ambiguity and add the necessity to remember special rules, just so that you can save typing one character per line. Sometimes. It's a bloody horrible idea. |