On 7 October 2011 12:10, Lasse Reichstein <[email protected]> wrote: > On Fri, Oct 7, 2011 at 12:09 PM, Fyodorov "bga" Alexander > <[email protected]> wrote: >> >> >> reason why many js coders still use ; is because they use other old >> langs such as c++/java. New langs such as Go and Scala dont requires ; >> because in most cases \n is ;. > > I agree on that, and in a language designed to not need semicolons, by > all means omit them. > My point is that I don't consider Javascript to be such a language. In > Javascript, omitting semicolons has been added as an afterthought, > with exceptions and tricky edge-cases that will eventually bite you. > Going for saving a semicolon per line at the cost of reducing > readability (to those people used to using semicolons in Javascript) > and reducing the obviousness of some tricky bugs just isn't worth it. > >> >> Imho ; is history of programming langs. >> ASI rules is so simple. > > Simple rules can have complex consequences. > >> Just dont write {return\n}, {throw\n} and >> {_foo()\n()} but who really write this code? Its abnormal code. > > Or: > > initializeSomething() > (function() { > // local scope for something > })() > > Or: > > a = b > (foo.bar || foo.baz).setLength(a) > > Or: > a = b > ["one","two"].forEach(function(v) { o[v] = f(v) }) > > Nobody would write that, right? > >> Since i use only modern langs i can forget about ; completely, its just >> syntax noise and force me type more. I type ; only one line lambdas to >> have explicit separator for my eyes. If i need write on some old lang >> - i can make small script which emulate ASI for this lang. > > Personally, I think writing in a language should be done on that > language's premises. That's what makes code sharing possible. If > everybody writes in their own language, they might be very productive, > but what they produce just isn't useful or maintainable. That's the > reason Java chose to not have C-style preprocessor macros. > > And I still think semicolons belong in Javascript. Sure, they can be > omitted, but it's not going to make anybody more productive (typing > isn't the bottleneck of programming), and the pitfalls are such that > you need a different, but just as systematic, way of using semicolons > where necessary. > Not something I'd recommend for beginners - just concentrate on the > meaning of the language constructs, and don't try to be smart with the > syntax. > > /L 'old and grumpy'
100% agree. If you're *that* upset by semicolons, use CoffeeScript. -- Nick Morgan http://skilldrick.co.uk @skilldrick Save our in-boxes! http://emailcharter.org -- 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]
