comp.lang.ada
 help / color / mirror / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
Subject: Re: [BBC] Programmers who use spaces 'paid more'
Date: Wed, 21 Jun 2017 18:48:22 +0200
Date: 2017-06-21T18:48:22+02:00	[thread overview]
Message-ID: <m2k2458ey1.fsf@informatimago.com> (raw)
In-Reply-To: oi5vui$cva$1@dont-email.me

"Mr. Man-wai Chang" <toylet.toylet@gmail.com> writes:

> Computer programmers who use spaces as part of their coding earn
> $15,370 (£12,000) more per year than those who use tabs, a survey of
> developers has revealed.
>
> Full story: <http://www.bbc.com/news/technology-40302410>

It is said that line prefixes in the form of: TAB* SPC{0,tw-1}
are the best of both world.

This is false.

First, you would need an editor to enforce it.

But it doesn't even solve the first problem of TAB, that their width
varies depending on tools and devices.

The problem is that the sequence of spaces must be of a length less than
the TAB width.  So if you start with tw₀ and have sequences of SPC of
length tw₀-1, and you read/process the file on another system using
tw₁<tw₀, then you will get wrong indentations.

Furthermore, when you allow TAB in source files, you may also use them
to align columns of code, eg. to align variable names in one column, and
types in another column.  And for those TAB in the middle of the lines,
the above rule is helpless, and again, you will get wrong indentations
in other environments, but also IN THE SAME ENVIRONMENT, where the TAB
width is kept constant, as soon as you use a different FONT, notably
when you use non-proportional fonts.

I know that it may seem heritic to use non-proportional fonts for code,
but the reality is that it can work very well, as long as you solve in
the IDE those problems of indentation, both prefix and inside a line.

And, it means the editor will have to compute the layout all the time,
from the parse tree.

Which leads me to the conclusion that the origin of a lot of problems is
the fact that we save "source" files that are used as-is both for
human presentation/edition and for machine processing (compiling).  I
would propose the alternative to save the programs eg. in the form of an
abstract syntactic tree (let's say lisp S-expressions), and each time it
is loaded in an IDE/editor, it would be unparsed into the specific
syntactic and layout/indenting preferences of the programmer; and when
saved, the programmer specific syntax would be parsed, and the
S-expression syntactic tree would be saved to the file.  Machine
processing can use directly these S-expression forms.

-- 
__Pascal J. Bourguignon
http://www.informatimago.com

  parent reply	other threads:[~2017-06-21 16:48 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-18 13:45 [BBC] Programmers who use spaces 'paid more' Mr. Man-wai Chang
2017-06-18 20:13 ` Per Sandberg
2017-06-18 23:03   ` J. Clarke
2017-06-19  0:22     ` Lew Pitcher
2017-06-19  5:50     ` Pascal J. Bourguignon
2017-06-19 14:28       ` Mr. Man-wai Chang
2017-06-20  3:00     ` Snit
2017-06-21 12:57       ` lyttlec
2017-06-19 10:46   ` Mr. Man-wai Chang
2017-06-19  1:19 ` Chris M. Thomasson
2017-06-19  2:23   ` J. Clarke
2017-06-19 19:42     ` Chris M. Thomasson
2017-06-20  1:49       ` frankmanning
2017-06-20  2:18         ` Dennis Lee Bieber
2017-06-21 13:02           ` lyttlec
2017-06-20  2:19       ` J. Clarke
2017-06-20 18:44         ` Chris M. Thomasson
2017-06-21 13:07         ` lyttlec
2017-06-19 10:47   ` Mr. Man-wai Chang
2017-06-19 11:24     ` AnthonyL
2017-06-19 12:26       ` Mr. Man-wai Chang
2017-06-19 13:53 ` JJ
2017-06-19 14:27   ` Mr. Man-wai Chang
2017-06-20 21:51   ` Anton Shepelev
2017-06-21 10:27 ` jm.tarrasa
2017-06-21 12:27 ` Simon Wright
2017-06-22  0:09   ` Robert Eachus
2017-06-21 16:48 ` Pascal J. Bourguignon [this message]
2017-06-21 16:52   ` Mr. Man-wai Chang
2017-07-05 18:36   ` Adam Jensen
2017-06-23  2:24 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox