[MPlayer-dev-eng] Indentation style (was: [PATCH] Fix useless dependencies in the stream lib)

Uoti Urpala uoti.urpala at pp1.inet.fi
Wed Apr 9 00:48:53 CEST 2008


On Tue, 2008-04-08 at 23:37 +0200, Alban Bedel wrote:
> On Tue, 08 Apr 2008 23:11:02 +0300
> Uoti Urpala <uoti.urpala at pp1.inet.fi> wrote:
> > I think letting "the maintainer" decide on use of non-standard tags
> > is a major problem with your proposal. The maintainer list often does

> Maintainer was meant in the broadest possible sense. You are making
> things a lot more complex than they need to be. Tags should obviously
> be handled just like the rest of the code in the file.

I think there would be reason to expect a lot more disagreement over
tags than most code. The very existence of different tags assumes there
is no agreement over what is to be preferred. Tags affect the whole file
and so are a lot more likely to affect other people than code changes.
For code changes that involve some amount of effort a reasonable default
is that if there are no objective arguments for preferring one way then
the person making the changes gets to decide; not so for tags.

> > If some file which uses non-standard formatting (especially other
> > than 4 space indent) gets many edits with 4-space indent then is
> > setting tags really the right answer? IMO it's questionable whether
> > it would be reasonable to set nonstandard tags, as obviously more
> > people than the original author need to work on it. Maybe reindenting
> > it to follow a common style would be a better choice.
> 
> Obviously tags can't be applied to files with mixed indentation. If
> and how we reindent files needing it is a different topic.
> IMHO files with just a few inconsistent part should be fixed to follow
> the rest and wild mixture should use an agreed style (I don't care
> which as long as there is tags ;)

I'm not talking only about files which already are mixed indentation. My
point was that if tags are needed to avoid a file _becoming_ mixed
indentation then it's questionable whether setting tags for any value
other than 4 space indentation is OK (I think that is clearly the most
"standard" one in MPlayer). If a file is edited enough by different
people that tags are really needed (assuming you consider mixed
indentation a serious problem) then it should probably use the most
common indentation style.

> > One example of a file which IMO should not require using nonstandard
> > style for edits is m_option.c. You originally wrote that file, but
> > working on options related to other code can easily require changes to
> > it, and it should not be considered anyone's "own" file.
> 
> This is again unrelated to the fact that files are tagged or not. Tags
> are only useful for files with a consistent indenting to help keeping
> it consistent. You are still free to reindent it (and accordingly
> update the tags ;) if you want/need to.

So you have no problem at all even with changing that file as a whole to
a common style and requiring all further changes to keep it? Then
exactly where do you draw the line where you DO have a problem? Since
you oppose a common indentation style overall I assume you must oppose
some such changes.

> > That there are files with mixed style shows that in practice many
> > files will be worked on by several people, at the same time or at
> > different times. Allowing the first person to work on the file to set
> > nonstandard tags and making such a style even more "official" for the
> > file would have a negative effect. Changing style every few lines is
> > a readability problem, but for example having some functions in a
> > different style is much less so IMO. So I think that at least adding
> > a new function in a common style should be OK even if the rest of the
> > file uses some weird style - adding more code in a weird style even
> > if the only person who likes that style isn't currently working on
> > the code is a problem too.
> 
> And who decide what "a weird style" is?

That does not need a definition based on the style itself here. Most
rare styles would be OK for examples.

>  What you seems to miss is that
> every file in the tree started with a consistent indentation.

You only focus on consistency, and only consistency within a file, as
the sole factor determining what is desirable. At least for myself a
file mixing a couple of most common styles plus a bit of some rare style
is more readable than a file written entirely in some completely unique
style.

>  Then ppl
> used editors with widely different settings and messed up things; in
> some places beyond recognition.

I think most of the really bad indentation cases in MPlayer were
actually produced as a result of people avoiding cosmetic changes, not
as a result of different styles. I'm not sure which places you're
referring to, but the "beyond recognition" messed up places I remember
don't seem like a problem with varying styles (at least not a mix of any
by themselves reasonable styles; if someone writes code with no
indentation that style is a problem in itself).

>  The problem is not that we have devs
> using aberrant styles, it's the mixture of badly configured editors.

I don't really agree, but since you don't specify what effects exactly
you consider a problem it's hard to say in detail what specifics I'd
disagree with.

> Personally I don't give a damn about any pet indentation style, all I
> want is readable code and not having to mess with indentation and
> tab-expansion settings every time I open a file.

Then exactly why do you oppose a common style? If you really wouldn't
"give a damn" then why would it cause you any problems?


Overall the tag proposal seems to assume the following:
1) Inconsistent indentation _within_ a file is a lot bigger problem than
   inconsistent indentation between files.
2) People should be more strongly required to change their style
   depending on which file they are editing.

I don't really agree with either of those. You rarely only look in one
file when making changes, and so having differently indented functions
in different parts of one file doesn't much differ from having
differently indented functions in different files. I don't have much
problem reading differently indented code, but trying to write code in
varying styles (even if the editor handles indentation) is much more
distracting.

So I don't think the goal of consistent indentation style on per-file
level is a worthwhile one (consistency on a per-line scale, and
consistency between all code you could work on at once could matter
more, but a file is not really a relevant unit - parts of a file are
about the same as different files). And if the per-file styles should be
strictly followed then most files should have a common style, which you
seem to oppose.




More information about the MPlayer-dev-eng mailing list