Re: gtk2-perl: moving on by standardizing our code



muppet <scott asofyet org> writes:

On Thu, 2003-03-13 at 17:24, Christian Borup wrote:
On ons, 2003-03-12 at 20:40, Guillaume Cottenceau wrote:
       C code
1: opening curly of a function after a newline

This seems inconsistent to me and less readable. I prefer { on the same
line. I see no difference from control structures.

C functions cannot nest, whereas C control structures can.  the
difference in brace style is therefore not so inconsistent.  java and
perl can nest functions, so open { of a function on the same line makes
sense for those languages.

I'd add to the rationale that in C, compared to Perl or other
languages, the function name and prototype doesn't provide any
keyword (whereas we have "sub" in Perl, etc), so putting a line
after it with a single { is helpful to better differentiate the
function name/prototype with the function contents.

c.f. linux kernel coding style, <kernelsrc>/Documentation/CodingStyle:
"Heretic people all over the world have claimed that this inconsistency
is ...  well ...  inconsistent, but all right-thinking people know that
(a) K&R are _right_ and (b) K&R are right.  Besides, functions are
special anyway (you can't nest them in C)."

I like those explanations :).


i think the important this is for us to write *maintainable* perl, which
is very different from "highly creative and ingenious" perl.  the latter
sometimes saves space and processing, but more often creates headaches
for maintainers of the resulting line noise; even the author can have a
hard time figuring it out after a month or two.

Agreed. Even if, for example, I'd use "and" instead of the infix
"if" in my personal code projects, I'm totally ready to still use
"if" in gtk2-perl so that we have a more maintainable project. I
agree we should restrict the use of too creative/ingenious perl
(without going back to C-like perl style of course).


-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



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