On Dec 25, 7:04 pm, pansz <panshi...@routon.com> wrote:
> Richard Hartmann 写道:> You are cheating by trying to align across several 
> levels of logical nesting.
>
> First, I'm not cheating, it *is* the real scenario in our everyday
> programming.
>
> > It's obvious that there is no flexible method of alignment in that 
> > situation,
> > today. You would need a meta-tab or something similar if you wanted
> > to achieve this in a text interface.
>
> Yes there is one method: use spaces.
>
> > I still maintain that this is not needed in the real world as maintaining
> > perfect alignment of behind-code comments is not practicable with
> > more than two or three level of indentation, anyway. _Especially_
> > with sw=8 which you seem to prefer.
>
> No, I don't say sw=8, I'd say ts=8 and sw=(what ever you want). i.e.
> don't rely on hard tab to do indent, tabs are used to create tables, not
> indent. Using spaces to do indent isn't the right way either, but in
> fixed-width-font world especially in programming, spaces are the most
> natural way for indent.
>
> > You definition of reasonable differs from mine.
> > The case you constructed serves as justification to force everyone
> > touching your code to adhere to your rules. Not a nice thing to do
> > at best, actively harming collaboration at best.
>
> If there is collaboration at all, developers need to use the same rule
> or the same coding style in the project anyway. At least the same coding
> style should be retained within one module. I see this to be a
> reasonable rule.
In this case, your argument against using tabs for leading indent
evaporates!!! If everyone adheres to the rule (and you just stated
that such rules were necessary), then even comments in different
logical blocks will be aligned (though I still maintain that trying to
achieve alignment of comments in different logical blocks is a bit
silly). If there must be a standard within a collaborative coding
group, the standard of "tabs for leading indent" offers advantages
over the "spaces for indent" method without any corresponding
disadvantages. The source files will be smaller, but more importantly,
each programmer viewing the code (even ones within the collaborative
group) can view indents as whatever width he prefers. Setting ts=8 and
sw=(whatever you want) pretty much ensures that when someone with a
different setting tries to view the source, everything will be screwed
up unless he deduces what settings you used to create the file and
changes his own settings to match. Of course, this is possible (and
not overly difficult for a Vim user) but with "tabs for leading
indent", the file just looks right naturally. Why require special
effort when it's unnecessary. Of course, you can ensure that the code
will "look right" (according to your definition of rightness) by using
expandtab, but I would advise against it for 2 reasons:
1) expandtab forces everyone to view indents as you do. As we've
already seen, there are a lot of different ideas about the "proper"
width of an indent, and I would argue that there isn't (and doesn't
need to be) agreement on which one is correct.
2) expandtab can waste a lot of space, especially when ts=8 and there
are lots of nested indents.
The bottom line is, there are a lot of significant advantages to "tabs
only for leading indent", and so far, the only disadvantage I've heard
is that comments in different logical blocks wouldn't be aligned for
someone using a different tabstop setting. Considering that pretty
much *nothing* would be aligned (code included) if a file with ts=8
and sw=(whatever you like) is viewed with different settings, the
argument against tabs for leading indent seems pretty weak to me.

Brett S.
>
> > Point in case, the Perl guidelines suggest sw=4 using soft tabs.
> > Forcing them to use sw=8 is just plain unfair.
>
> Again, I'm saying ts=8 and sw=(what ever you want). And that is
> *recommended* by official vim documents. If someone claims that spaces
> waste more bytes than hard tabs, he can :set noet, which will change all
> leading 8 spaces into hard tabs and there isn't too much bytes wasted by
> the space character.
>
>
>
> > Richard
>
> Pan, Shi Zhu
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to