← Back to team overview

elementary-dev-community team mailing list archive

Re: Functions

 

Am 02.01.2012 17:19, schrieb David Gomes:
> Ideally, for me, I'd love:[...]
> It's the best way because the parentheses are aligned, so I can see
> where the function starts and where it ends.
>
> However, I know most of you don't like it, we'll have to choose
> between these: (notice the empty line difference)
As far as I'm concerned, 90% of all Vala code is written with hanging
curly brackets (in the same line). And imho it is a waste of time to
re-iterate personal preferences unless you want to make typical Vala
code as messy as C code. It's not my preference either for what I want,
but it's consistent.
cf. http://live.gnome.org/Vala/Tutorial

I tend to leave a space before the code usually if the arguments go in
more than one line. Also if there are several declarations a line can
emphasize it. Otherwise, it feels redundant. Pretty much like brackets
around "if" and "else" - they feel odd if it's just one line.

> http://goo.gl/l7a88 I'm also working on this. I decided I would do
> this because I'm a coding style freak. Code needs to be perfect and
> consistent along all of our applications. In fact, I can volunteer to
> fix all the dirty code we have (it's boring, but I don't care, I love
> doing it) in all our apps, but only after we have a coding style defined.
You got the curly brackets reversed.

Follow ups

References