30.09.2016, 15:19, "Kai Koehne" <[email protected]>: > Hi, > > It’s Friday, so time for some bikeshedding ;) > > As you might know, the semicolon as a statement separator in JavaScript is > optional. That is, most of the time you can just separate commands > > by newlines. There are a few pathological cases [1] though where a semicolon > is needed. It seems the JavaScript world is divided on the topic > > whether to use semicolons by default though. > > Now I do not care that much about JavaScript as a language, but I do care > about consistency in the Qt documentation and examples. Unfortunately > > we didn’t seem to have made a call so far what to prefer. Even our minimal > “QML coding conventions” at http://doc.qt.io/qt-5/qml-codingconventions.html > > feature a semicolon in places, and in others no semicolon. > > To make a proposal: Let’s use semicolons in imperative JS parts of QML in our > examples and documentation. > > Apart from being on the safe side regarding some pathological cases, it also > makes the difference between declarative QML bindings and > > imperative JS code more explicit. > > Now I do realize that the right side of QML bindings is actually JavaScript. > But no, I do not want to propose that now every binding ends with a ‘;’. > > A good rule of thumb might be that semicolons should be used inside either > function X() {} or OnSignalHandler: {} blocks, or in .js files. > > Thoughts? > > Kai > > [1]: See e.g. > http://benalman.com/news/2013/01/advice-javascript-semicolon-haters/
I think that would be fine to require semicolons everywhere except last statement (and if there is single statement in the binding, no semi-colons are needed at all) > > -- > > Kai Köhne, Senior Manager R&D | The Qt Company > > The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin > > Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der > Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 > B > > Qt World Summit 2016 | Pier 27, San Francisco, CA > > Experience Exponential Potential on October 18-20 > > www.qtworldsummit.com > > , > > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development -- Regards, Konstantin _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
