I hate you all

G

Grant Edwards

Personally I have always used 4 spaces. I use it in SQL, shell
scripts and Python. It makes code simple to read, and unambiguous.

Same here -- mostly because that's what the emacs "Python-mode" does
by default, and it seems to be commonly accepted "right way". All
things being equal, I'd pobably pick 2 or 3, but 4 is fine.
The fact of Python enforcing it (or all tabs; a poor second choice)
is *a good thing*, easy and natural IMHO. No need for "end if" or
"end loop" or "fi". One wonders whether OP is simply trolling.

If he was trolling, he certainly deserves a prize.
 
C

Chris Angelico

If he was trolling, he certainly deserves a prize.

I don't think he was trolling. It was a classic-model rant: "I
upgraded my dependency to a newer version and all my stuff broke".
Commonly provokes anger, largely because many such upgrades do NOT
break stuff (eg if I were to switch from gcc 4.5 to gcc 4.7 right now,
I doubt anything would break, and my code would be able to use the new
iterator syntax in c++11 - pity 4.7 isn't packaged for Debian
Squeeze). The OP upgraded across an openly-non-backward-compatible
boundary, and got angry over one particular aspect of backward compat
that wasn't there.

ChrisA
 
C

Chris Angelico

But wouldn't it have been easier simply to do do a quick sed or whatever
rather than to spend hours here arguing?

Probably. I don't profess to understand the OP's brain *that* much!

ChrisA
 
S

Steven D'Aprano

And your point is?

Typewriters don't have a tab "character". The information regarding tab
stops is conveyed out-of-band from the typist to the typewriter, and
doesn't need to persist beyond the time taken to type the document.

Both text editors and typewriters encode information about tab settings
out of band. Editors encode that information in some combination of
program configuration, command-line switches, environment variables, and
embedded mode lines in the document itself. Typewriters encode that
information in the typists' memory, or failing that, in the actual
physical space left on the page. That's a difference that makes no
difference.

My point is that there were well-established semantics for what a tab
should do, and the "8 character tab" is not that. Pressing the tab key on
a keyboard while entering text ought to instruct the editor to advance to
a specified tab stop capable of being set anywhere on the page. Word
processors use that model: the word processor stores the positions of the
tab stops out of band, usually in the "paragraph formatting" or "style
sheet", but in principle they could keep the position of the tab stops
global to the document or even global to the application.

Good text editors also support this model. Some versions of Vim, for
example, include a feature called "variable tabstops". Emacs includes a
variable called tab-stop-list which can set variable tab stops[1]. Even
the Linux command "less" supports variable width tabs, with the -x option.

In case you think this is only for Unix editors, the Windows "Boxer Text
Editor" also supports variable tab stops.

There may, or may not be, good reasons for an eight character default
setting for tab stops. But eight characters is not, and never has been,
the One True Way of setting tab stops.




[1] Although what happens when you press the tab key in Emacs is so
complicated that only three people in the world have ever understood it
fully. The first is Richard Stallman, then second is dead, and the third
has gone mad.
 
R

rusi

Both text editors and typewriters encode information about tab settings
out of band. Editors encode that information in some combination of
program configuration, command-line switches, environment variables, and
embedded mode lines in the document itself. Typewriters encode that
information in the typists' memory, or failing that, in the actual
physical space left on the page. That's a difference that makes no
difference.

My point is that there were well-established semantics for what a tab
should do, and the "8 character tab" is not that. Pressing the tab key on
a keyboard while entering text ought to instruct the editor to advance to
a specified tab stop capable of being set anywhere on the page. Word
processors use that model: the word processor stores the positions of the
tab stops out of band, usually in the "paragraph formatting" or "style
sheet", but in principle they could keep the position of the tab stops
global to the document or even global to the application.

Dunno what you mean by 'out-of-band'
If I set tabstops for a para to say 4-13-25-36 in a wordprocessor,
save the file and look inside, I will find the tuple (4,13,25,36) in
some encoded form.
For a typewritten page, if the margin seems to be at 11th col, the
reader cannot know from the page alone whether the typist
1. set the tab at 11
2. set the tab at 8 and pressed TAB followed by 3 SPC
3. Started with 2 and switched to 1
 
R

rusi

Dunno what you mean by 'out-of-band'
If I set tabstops for a para to say 4-13-25-36 in a wordprocessor,
save the file and look inside, I will find the tuple (4,13,25,36) in
some encoded form.

To make this conform to current practices, I should use some length-
unit not characters which I had in mind.
 
S

Steven D'Aprano

Dunno what you mean by 'out-of-band'

I mean that the information about the tab stops are not inherent to the
tab itself.

If I set tabstops for a para to say 4-13-25-36 in a wordprocessor, save
the file and look inside, I will find the tuple (4,13,25,36) in some
encoded form.

There's nothing about the *tab character itself* that says "jump to
column 25". That information is metadata, stored external to the tab.
That doesn't necessarily mean external to the file. A word-processing
file carries a lot of metadata about the document.

A plain text file is a better example. If I type up a document in (say)
OpenOffice and use tabs to align a table, I might manually set the tabs
to 4cm, 9cm, 18cm. When I hit tab, the cursor will jump to (say) 18cm,
but if I save the document as plain text, that information is not stored
anywhere in the document. It may be encoded in the OpenOffice config,
e.g. in the "Normal" stylesheet.

The same applies for documents created in a text editor, say Vim or
Emacs. They may store the metadata about tab settings as mode lines in
the document, or in an environment variable, or in a config file, or
perhaps nowhere at all. Just like a typewriter.

For a typewritten page, if the margin seems to be at 11th col, the
reader cannot know from the page alone whether the typist 1. set the tab
at 11
2. set the tab at 8 and pressed TAB followed by 3 SPC 3. Started with 2
and switched to 1

Very true. Manual typewriters are not identical to text editors.
Typewriters can do both more *and* less than text editors. E.g. you can
compose extra symbols by backspacing and overtyping, but you cannot
usually distinguish between space-tab and space-space-tab.

But from the perspective of "duplicate what you see on the page", the
difference between space-tab and space-space-tab does not matter. What
matters is where you end up, not how you get there.
 
C

Chris Angelico

| sed -e '/What.*n.t/{s//Sure I/;s/?/!/};/^-- /{r .signature' -e'q}'

A very apt response. Oh wait, I already have sed on this system, don't
need to fire up apt.

ChrisA
 
M

Mark Lawrence

What, you don't think sed is fun?

Having never really used a *nix box in anger how would I know? A
substantial portion of my career was spent on a combination of VMS, C
with embedded SQL and Ingres. Please don't ask as I don't know the
answer :)
 
G

Grant Edwards

Having never really used a *nix box in anger how would I know? A
substantial portion of my career was spent on a combination of VMS,

That's no excuse -- DECShell for VMS included sed! :)

I spent many months months writing a set of shell-scripts and
makefiles that used awk, sed, and their brethren to do automated
testing and building of an 1100 page document that was written in
LaTeX. It was all on a VMS system. Unfortunately, the massive
process-creation overhead of VMS hit shell-scripts pretty hard -- a
full V&V run and document build took something like 7 hours. We
usually only ran it overnight.
 
M

Mark Lawrence

Anti-virus, anti-malware, defragmenters, registry cleaners, needing to
reboot every time I install or update software?

No grep, no awk, no sed?

No thanks.

But never mind; each to his own. I don't want to spark OS wars.

I haven't the faintest idea what your response means so please explainn.
 
S

Steven D'Aprano

I haven't the faintest idea what your response means so please explainn.


Walter is pointing out that as a Windows user, you probably have to deal
with problems that Unix users are barely even aware of, like viruses, the
registry, having to reboot after installing software, etc., and you are
missing out on oodles of useful and powerful tools like grep. He finds
your decision to use Windows curious, but respects your decision to use
it and doesn't want to get into an unproductive war over which is the
best OS.
 
M

Mark Lawrence

Walter is pointing out that as a Windows user, you probably have to deal
with problems that Unix users are barely even aware of, like viruses, the
registry, having to reboot after installing software, etc., and you are
missing out on oodles of useful and powerful tools like grep. He finds
your decision to use Windows curious, but respects your decision to use
it and doesn't want to get into an unproductive war over which is the
best OS.

How did VMS get translated into Windows? :)
 
C

Chris Angelico

From Mark's reply to me:
User-Agent: Mozilla/5.0 (Windows NT 6.0;
rv:17.0) Gecko/20130328 Thunderbird/17.0.5

My headers say I use Windows, too, but I actually use Linux.

ChrisA
 
S

Steven D'Aprano

My headers say I use Windows, too, but I actually use Linux.

Actually, no they don't. They don't say anything about your OS, and there
is no User-Agent string.

Since Mark claims to have not seriously used Unix, that rules out Linux,
FreeBSD, OpenBSD, and modern Apple Mac. It's just barely possible that
he's still using VMS or Hurd, but really, by a process of elimination the
most likely answer is that he's using Windows.
 
C

Chris Angelico

Actually, no they don't. They don't say anything about your OS, and there
is no User-Agent string.

Since Mark claims to have not seriously used Unix, that rules out Linux,
FreeBSD, OpenBSD, and modern Apple Mac. It's just barely possible that
he's still using VMS or Hurd, but really, by a process of elimination the
most likely answer is that he's using Windows.

Heh, I didn't actually check. But if my user-agent _were_ being
recorded anywhere, it would make it seem that I use Windows.

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top