I
Iain King
Oh God, I agree with Xah Lee. Someone take me out behind the chemical
sheds...
Iain
sheds...
Iain
Sybren said:I agree with that.
But not with that, since it is contradicting. "Inserting the
characters" could very well be the same as "performing the expected
operations".
(and it is even more complex when you are editing something like Pythonindent-previous command
Indent based on the previous line.
This command makes the current line start at the same column as the
previous non-blank line. Specifically, if you invoke this command
with point in or adjacent to a line's indentation, indent-previous
replaces that indentation with the indentation of the previous
non-blank line. If point's indentation exceeds that of the previous
non-blank line, or if you invoke this command with point outside of
the line's indentation, this command simply inserts a tab character.
If a region is highlighted, Epsilon indents all lines in the region by
one tab stop. With a numeric prefix argument, Epsilon indents by that
amount.
It could be, and for some keys (q, w, e, r, t, y, etc. spring to
mind) that is quite a reasonable implementation. For others 'tab',
'backspace', 'enter', 'delete', etc. it is less reasonable, but it
is a quality of implementation issue. If I had an editor which
entered a control character for each of these I would simply move to
a better editor.
The problem is that behaviour like this is useful, and mostly even
intuitive, but it's a long way from the definition of a tab or even
the little metal clips you used to stick on the back of a manual
typewriter.
[...]Xah said:Tabs versus Spaces in Source Code
Xah Lee, 2006-05-13
In coding a computer program, there's often the choices of tabs or
spaces for code indentation. There is a large amount of confusion about
which is better. It has become what's known as “religious war†—
a heated fight over trivia. In this essay, i like to explain what is
the situation behind it, and which is proper.
Simply put, tabs is proper, and spaces are improper.
Why? This may seem
ridiculously simple given the de facto ball of confusion: the semantics
of tabs is what indenting is about, while, using spaces to align code
is a hack.
... and the solution is to advance
the sciences such that your source code in some way
embed such information.
[email protected] opalinski from opalpaweb said:The reality of programming practice trumps original intent of tab
characters. The tab character and space character are pliable in that
if their use changes their semantics change.
If/when time comes where such info is embeded perhaps then tabs will be
OK.
---------------------------------------------------------------
I use spaces because of the many sources I've opened I have many times
sighed on opening tabed ones and never done so opening spaced ones.
I don't get mad, but sighing is a clear indicator of negativity.
Anyway, the more code I write and read the less indentation matters to
me. My brain can now parse akward source correctly far bettter than it
did a few years ago.
<more worthless nonsense>Iain said:Oh God, I agree with Xah Lee. Someone take me out behind the chemical
sheds...
Xah Lee wrote:
[...]The reality of programming practice trumps original intent of tab
characters. The tab character and space character are pliable in that
if their use changes their semantics change.
achates said:A tab is not equivalent to a number of spaces. It is a character
signifying an indent, just like the newline character signifies the end
of a line.
Duncan said:but I prefer editors which keep things
simple. The tab key is particularly prone to excessively complicated
actions, for example the editor I use has the following (not simple at
all, and in fact not even an accurate description of what it does) binding
for the tab key:
Xah said:Tabs vs Spaces can be thought of as parameters vs hard-coded values, or
HTML vs ascii format, or XML/CSS vs HTML 4, or structural vs visual, or
semantic vs format. In these, it is always easy to convert from the
former to the latter, but near impossible from the latter to the
former.
achates said:With spaces for indentation, this just isn't possible, because I have
to conform to your viewing preferences, and that makes me unhappy. Why
would you want to make me unhappy?
Kaz said:If you want to do nice typesetting of code, you have to add markup
which has to be stripped away if you actually want to run the code.
Because it doesn't mean 'one level of indentation', it means 'move to nextachates said:You haven't explained why you think there's a problem with having a
character which, in an unambiguous and non-implementation-specific way,
means 'one level of indentation'. In Python, of all languages, it makes
sense to have such a character because 'one level of indentation' is a
syntactical token processed by the interpreter.
Duncan said:Because it doesn't mean 'one level of indentation', it means 'move to next
tabstop' and a tabstop isn't necessarily the same as a level of
indentation.
In particular a common convention is to have indentations at 4
spaces and tabs expanding to 8 spaces.
achates said:Like all space-indenters, you seem to be hung up on the idea of a tab
'expanding' to n spaces. It only does that if you make your editor
delete the tab character and replace it with spaces! Really, that is
the only sense in which your statement makes any sense. If you want
your indentation to have the width of four, eight, or nineteen spaces,
set your tabstops accordingly.
Seriously people, this is about separating the content of a source file
from how it is displayed. It's about letting people work together while
also allowing them to have control over their own environments,
something which is and always has been central to the hacker ethos.
achates said:Typesetting code is not a helpful activity outside of the publishing
industry.
You might like the results of your typsetting; I happen not
to. You probably wouldn't like mine. Does that mean we shouldn't work
together? Only if you insist on forcing me to conform to your way of
displaying code.
You are correct in pointing out that tabs don't allow for 'alignment'
of the sort you mention:
(lisp
(nested list
with symbols
and things))
But then neither does Python. I happen to think that's a feature.
(And of course you can do what you like inside a comment. That's
because tabs are for indentation, and indentation is meanigless in that
context.
Duncan said:However the important thing is that a tab does
not map to a single indentation level in Python: it can map to any number
of indents, and unless I know the convention you are using to display the
tabs I cannot know how many indents are equivalent to a tabstop.
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.