Re: Coding style discussion, low priority ideas



Hi!

I can appreciate different aspects of different coding styles. The GNU
style is a bit weird, but it is kind of nice to have open/close braces
line up horizontally. And while I think generally that two space
indentation is too little, it does make sense for Gnome C code with
its typically very long function names.

For Vala code, I'm not so sure. I agree with the benifits of
conromity, but I haven't seen the GNU style used very much for Vala
code? The "Java style" indentation with four spaces and hanging braces
is used in Gnome Javascript code [1], I think that works well for Vala
code as well. It is used in some Gnome Vala projects like Baobab,
Cheese and Calculator. The Yorba folks are also using it in Geary and
Shotwell. The Vala compiler style is [2] similar, but has the
recommendation to redefine the "tab" character to four spaces, which I
don't like as it breaks when code is viewed in anything but your
editor.

Then there are of course a whole bunch of stylistic issues that are
Vala-specific, such as how to write properties. Since much of this is
similar to C#, I think some good ideas can be found in the Mono
project's style guide [3].

Just some thoughts. I'm ok with adapting to whatever. :)

Good work on the release!

/simon

[1] https://wiki.gnome.org/Gjs/StyleGuide
[2] https://wiki.gnome.org/Vala/Hacking#Coding_Style
[3] http://www.mono-project.com/Coding_Guidelines



On Sun, Aug 25, 2013 at 4:40 PM, Richard Schwarting
<richard schwarting ca> wrote:
Hello.

Daniel, Simon, I noticed you guys like to align your method parametres
vertically, like in GTK+, so I'm going to do that too!

Looking around, I think I'd like to follow GNU/GTK+'s coding style generally
http://www.gnu.org/prep/standards/standards.html#Writing-C
https://git.gnome.org/browse/gtk+/plain/docs/CODING-STYLE
https://wiki.gnome.org/GTK+/BestPractices

It's what libfolks, the other notable Vala library in GNOME, seems to do,
and seems to be common in GNOME
https://git.gnome.org/browse/folks/tree/folks/postal-address-details.vala

I might adjust the spacing in the files I've mostly written to two-space
instead of tab.  That said, I don't want anyone to waste their time
rewriting code right now! :)  I just want your thoughts on this.

(NOTE: I personally disdain the bracketing style in GNU style, but I
appreciate the benefits of conformity in large group projects)

Cheerio,
  Richard


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]