[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: QML style guide
From:       "Aaron J. Seigo" <aseigo () kde ! org>
Date:       2012-10-30 19:47:29
Message-ID: 1507161.Qh5BniDccg () freedom
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Tuesday, October 30, 2012 18:16:26 Aurélien Gâteau wrote:
> In the example, "property alias bar : actual.property": there is a space
> before the colon, is it on purpose?

nope. my mistake. i've fixed it now. thanks for noticing :)

> I think it would be good to standardize the id of the top-level item. So far
> I have often seen "main" or "root" used.

agreed; though i'd like to see in the Best Practices section as there will be 
exceptions.

i like "root" as it is also used in the QML documentation in several places.
 
> JS lines should end with semi-colons. This is expected by JSLint anyway, but
> I think it is invasive enough to be mentionned explicitly.

agreed. in fact, there is already this:

      fooFunction(); // in blocks, kdelibs style, including semicolons at EOL
 
but that is evidently not noticeable enough. i've addded this to the "JS Code 
Blocks" section.

> The only part I don't really like is putting left curly brace on its own
> line for functions because:
> 
> - having different conventions for event-handlers and function code blocks
> look inconsistent

fwiw, it's not just event handlers. things like:

anchors {

}

also have on-the-same-line braces and, due to the lovely consistency that is 
QML, does not have a ':'

> - it differs from many coding styles: Qt QML JavaScript, Douglas Crockford,
> jQuery, Node... so I think it is going to look odd and unfamiliar to many
> newcomers.

every style differs from many coding styles. we also don't use Linux kernel 
style. so that is not a useful argument imho.

my main gripe is that this creates an exception relative to every other bit of 
code we write in any other language. as it is right now, some of our JS code 
is written one way, and others another. 

if we do go with "always { on the same line", several us in the core team swap 
regularly between C++ and QML/JS and this becomes an annoyance through 
inconsistency and will require additional discipline as suddenly it will 
matter what language you are using :/

what i really, really don't want is .qml files with JS in them and .js files to 
have different styles.

anyways, i don't have a hugely set opinion on which way to do this. on-new-
line means one less exception to the kdelibs style to follow; on-same-line 
means QML elements and JS functions look more similar. personally, i'm not 
100% happy with either choice :P

-- 
Aaron J. Seigo
["signature.asc" (application/pgp-signature)]

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic