lua-users home
lua-l archive

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


On Mon, Jan 06, 2014 at 11:03:33AM +0000, Craig Barnes wrote:
> On 5 January 2014 20:45, William Ahern <william@25thandclement.com> wrote:
> > Indentation and alignment are two separate issues. We can _all_ agree that
> > blocks should be indented, just not what the width should be. Use tabs and
> > _every_ can be made happy by setting their tab stop.
> >
> > If you prefer a particular alignment when wrapping statements, expressions,
> > and comments, then align them--using spaces. It's far easier for people to
> > deal with quirky alignments then it is to deal with quirky and annoying
> > indentation. And because alignments can be very complex--with invariably
> > corner cases that require you to violate your own rules--editors do a
> > horrible job of reflowing alignments of complex statements, so better to
> > just disable that feature (please!).
> >
> > If you use tabs for indentation and spaces for alignment, then when people
> > change their tab stop your alignment will still magically work.
> >
> 
> Except that as soon as your code has tabs in it, all bets are off for aligning
> anything. A tab is a variable-width character and is incompatible with
> the notion of monospace alignment. It might seem to work so long as you
> always view it in the same editor with the same tab width, but it'll surely
> break as soon as someone views it with a different tab width.

If you use tabs for indentation and spaces for alignment, then your tab stop
is inconsequential. No matter your tab stop, anything you align within an
indented block will stay aligned.

Indentation always comes on the left-hand side. Anything you align inside of
a block will always have the same number of tabs, and will always shift
right or left as one block. It will all remain aligned correctly.

For example, take an ASCII art picture. If you insert an equal number of
tabs at the left, the picture will remain aligned, just shifted over. The
tab stop won't magically take it out of alignment.