[OT] Spaces/tabs (Was: simple display (from: GUI library for D))

Cliff Hudson cliff.s.hudson at gmail.com
Mon Apr 11 22:33:01 PDT 2011


Spaces *should* only be used within string constants (as needed), or when
the language otherwise requires them.  The editor should format the code
according to user preferences.

Absent that, spaces represent the lowest common denominator of formatting,
so we can all use them and our text shows up as we desire regardless of
editor or setting.

Can we move along now?  This argument was old 30 years ago.  Perhaps we
should do VI vs. EMACS while we are at it.

</snipe>

On Mon, Apr 11, 2011 at 10:13 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:

> > "Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message
> > news:mailman.3412.1302578409.4748.digitalmars-d at puremagic.com...
> >
> > >> On 04/11/2011 08:13 AM, Jonathan M Davis wrote:
> > >> > They mix tabs and spaces. On some lines, they use spaces and on
> others
> > >> > they use tabs.
> > >>
> > >> Never seen this, not even once. Messing can only happen when one
> > >> copy-pastes from modules using spaces.
> > >
> > > As Steve pointed out, it frequently happens when you have multiple
> > > developers
> > > working on the same code. It may work with one developer who likes
> using
> > > tabs,
> > > but as soon as you get a mix of developers, you invariably get a mix of
> > > spaces
> > > and tabs unless _everyone_ involved is really careful, and that rarely
> > > happens. It's just too easy to use spaces without realizing that
> someone
> > > else
> > > used tabs or even that you yourself are using spaces, depending on your
> > > editor's settings.
> >
> > That applies the other way around, too.
> >
> > > Using only spaces and no tabs avoids the entire issue...
> >
> > It avoid the issue *as well as* using only tabs for indentation.
>
> No, because you _always_ have spaces. It's not like you stop using the
> spacebar just because your tab key is actually inserting tab characters. If
> you have tabs, then you're still going to have spaces. It's just a question
> of
> whether those involved in the project are disciplined enough to avoid ever
> using spaces for indenting. If, on the other hand, you only allow spaces,
> then
> you don't have the same concern about tabs being inserted. True, someone's
> editor could be set up poorly for either situation and insert spaces where
> they shouldn't or tabs where they shouldn't, but it's generally trivial to
> set
> up an editor to _never_ input tabs that it's easy to make it so that tabs
> are
> never used. However, the same can't be said of using tabs, because it's
> always
> possible to input spaces with the spacebar.
>
> It's true that people occasionally end up inserting tabs in space-only
> environments, but in my experience, it's fairly rare. It's pretty much a
> guarantee, however, that _someone_ will insert spaces in an environment
> where
> it's supposed to be tabs.
>
> There's not much point in arguing the matter. Some folks prefer tabs, and
> some
> prefer spaces, but I believe that it's most common for spaces to be
> preferred
> as far as style guides go, and they're generally less error-prone simply
> because it's easy enough to set up editors so that tabs are never used, and
> you can't do the same with spaces when you're using tabs for indentation.
>
> - Jonathan M Davis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110411/6174771c/attachment.html>


More information about the Digitalmars-d mailing list