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

2011-06-04 Thread Jeff Nowakowski

On 06/03/2011 02:48 PM, Walter Bright wrote:


In the beginning, God created tabs. Tab stops were 8 spaces


It's 2011. The idea that some character means 8 spaces and should be 
used to layout code is ass-backwards, regardless if everybody actually 
followed that rule. It was a fine rule for 1960.


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

2011-06-03 Thread Bruno Medeiros

On 12/04/2011 20:49, Nick Sabalausky wrote:



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



Pico rules them all! ;)




Vi *and* Emacs suck. Argument settled :P

(yes, that was hyperbolic rhetoric)

--
Bruno Medeiros - Software Engineer


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

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 05:45, Bruno Medeiros wrote:
 On 12/04/2011 20:49, Nick Sabalausky wrote:
  Can we move along now? This argument was old 30 years ago. Perhaps we
  should do VI vs. EMACS while we are at it.
  
  Pico rules them all! ;)
 
 Vi *and* Emacs suck. Argument settled :P

Yeah, I got sucked in by vim, and I've never gotten away. ;)

- Jonathan M Davis


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

2011-06-03 Thread Andrej Mitrovic
I bet you wrote std.datetime with a call to a single Vim macro.

Just kidding. :P


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

2011-06-03 Thread Jonathan M Davis
On 2011-06-03 11:01, Andrej Mitrovic wrote:
 I bet you wrote std.datetime with a call to a single Vim macro.
 
 Just kidding. :P

That sort of talk leads to things like this: http://xkcd.com/378/

- Jonathan M Davis


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

2011-06-03 Thread Walter Bright

On 4/10/2011 10:58 PM, Daniel Gibson wrote:

Am 11.04.2011 07:51, schrieb Jonathan M Davis:

Yes. Phobos follows the convention of indenting with spaces and that levels of
indentation are 4 spaces. So, anything which goes into Phobos needs to follow
this convention.

the only way that tabs work is if you use them consistently, which in my
experience almost never happens.


How can people mess that up?


In the beginning, God created tabs. Tab stops were 8 spaces. That was engraved 
in tty and printer hardware, and there was nothing any user could do about it. 
And it was good, and there was peace in the land.


But then in the 80's satan thought that it would be a good idea to make tabs 
user settable (soft tabs) in his text editor. Various demons and trolls thought 
this was a fab idea, and propagated it to every text editor.


Unfortunately, text files have no way to specify the tab size expected by the 
text. Conventions were proffered, noobs were sacrificed, and hymns sung, but 
nobody could ever agree on what the tab size should be. Bikeshed wars raged and 
devastated the land.


Hence, the use of tabs was utterly, totally and perpetually ruined for everyone. 
And satan laughed at the folly of programmers.


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

2011-06-03 Thread Walter Bright

On 4/11/2011 8:31 AM, Adam D. Ruppe wrote:

Yeah, that's all that matters in the end. When in Rome...

But it's trivial to do a find and replace all before submitting so
really, it's just not a big deal.


Before I check in, I run tolf and detab on the source files.


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

2011-06-03 Thread Walter Bright

On 4/11/2011 1:31 PM, Nick Sabalausky wrote:

In other words, *some* editors handle space-indentation intelligently (and
do so by reinventing *tabs*), while *all* editors handle tab-indentation
intelligently.


There is no way to handle tabs intelligently.

Take a source file that has tab characters in it. There is no algorithm in the 
world that will discern what the tab size is supposed to be. Heck, I've seen 
plenty of source files that assume a tab size of X in some sections and Y in 
others, and Z in still others.


The only way to win is to not use tabs.



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

2011-06-03 Thread Adam D. Ruppe
8 space tabs are the One True Way. All other tabstops are evil.


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

2011-06-03 Thread Daniel Gibson
Am 03.06.2011 20:54, schrieb Walter Bright:
 On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
 In other words, *some* editors handle space-indentation intelligently
 (and
 do so by reinventing *tabs*), while *all* editors handle tab-indentation
 intelligently.
 
 There is no way to handle tabs intelligently.
 
 Take a source file that has tab characters in it. There is no algorithm
 in the world that will discern what the tab size is supposed to be.
 Heck, I've seen plenty of source files that assume a tab size of X in
 some sections and Y in others, and Z in still others.
 
 The only way to win is to not use tabs.
 

If you use tabs for indentation and spaces for alignment the tabsize
doesn't matter.


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

2011-06-03 Thread Timon Gehr
Daniel Gibson wrote:
 Am 03.06.2011 20:54, schrieb Walter Bright:
 On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
 In other words, *some* editors handle space-indentation intelligently
 (and
 do so by reinventing *tabs*), while *all* editors handle tab-indentation
 intelligently.

 There is no way to handle tabs intelligently.

 Take a source file that has tab characters in it. There is no algorithm
 in the world that will discern what the tab size is supposed to be.
 Heck, I've seen plenty of source files that assume a tab size of X in
 some sections and Y in others, and Z in still others.

 The only way to win is to not use tabs.


 If you use tabs for indentation and spaces for alignment the tabsize
 doesn't matter.

http://www.emacswiki.org/emacs/SmartTabs

In a perfect world, everyone would do that. But if multiple people are working 
on
the same source, one of them will mess up the formatting...



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

2011-06-03 Thread Adam Richardson
On Fri, Jun 3, 2011 at 3:04 PM, Daniel Gibson metalcae...@gmail.com wrote:

 Am 03.06.2011 20:54, schrieb Walter Bright:
  On 4/11/2011 1:31 PM, Nick Sabalausky wrote:
  In other words, *some* editors handle space-indentation intelligently
  (and
  do so by reinventing *tabs*), while *all* editors handle tab-indentation
  intelligently.
 
  There is no way to handle tabs intelligently.
 
  Take a source file that has tab characters in it. There is no algorithm
  in the world that will discern what the tab size is supposed to be.
  Heck, I've seen plenty of source files that assume a tab size of X in
  some sections and Y in others, and Z in still others.
 
  The only way to win is to not use tabs.
 

 If you use tabs for indentation and spaces for alignment the tabsize
 doesn't matter.


This is my preferred approach, too.

Adam


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

2011-06-03 Thread Stewart Gordon

On 03/06/2011 19:06, Jonathan M Davis wrote:
snip

That sort of talk leads to things like this: http://xkcd.com/378/


I was told that Real Programmers use punch cards.  Someone must've found some even realer 
programmers


Stewart.


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

2011-06-03 Thread Stewart Gordon

On 03/06/2011 20:15, Timon Gehr wrote:

Daniel Gibson wrote:

snip

If you use tabs for indentation and spaces for alignment the tabsize
doesn't matter.


http://www.emacswiki.org/emacs/SmartTabs


Taken the words out of my mouth there.  I've been faced with files that are a mishmash of 
tabs and spaces, and been tidying them up to this style.


The problem is that some editors will, when you indent a block of code, change the 
alignment spaces back into tabs.  Though I do find that feature useful as a first step in 
cleaning up sources that are in a total mess in terms of tab/space indentation.  At work 
we use Visual Studio, but when I find that a source file needs tidying I would open it in 
Notepad++ as it behaves in this way.  I also tend to use its Trim Trailing Space feature 
quite often


Stewart.


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

2011-06-03 Thread Walter Bright

On 6/3/2011 5:14 PM, Stewart Gordon wrote:

On 03/06/2011 20:15, Timon Gehr wrote:

Daniel Gibson wrote:

snip

If you use tabs for indentation and spaces for alignment the tabsize
doesn't matter.


http://www.emacswiki.org/emacs/SmartTabs


Taken the words out of my mouth there. I've been faced with files that are a
mishmash of tabs and spaces, and been tidying them up to this style.


Good luck making that work.


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

2011-04-14 Thread spir

On 04/13/2011 11:44 PM, Andrei Alexandrescu wrote:

On 4/13/11 4:17 PM, Jérôme M. Berger wrote:

Well, standard (printed) typographic practices put spaces outside
the parenthesis and none inside. And as opposed to a lot of
typographic rules, that one is a constant across languages and variants.


Math typography rules also preclude inserting a space between a function's name
and the opening brace. That's why I consistently go with no space after the
opening paren or before the closing paren. Also, that's why there's no need to
make if (condition) and func(args) consistent with regard to space before
opening paren. In the first case the paren is pure punctuation; in the latter
it is an organic part of the function invocation syntax. So one should never
leave a space between function name and opening paren, and decide independently
regarding the existence of a space between if/while etc. and the opening paren.


Agreed.
In the same vein, function definition is not a function call; thus I use to 
write:

int square (int n) {
return n * n;
}
sq = square(3);

Actually, I have never been pleased that func defs (1) look like func calls (2) 
have an exceptional syntax compared to other definitions. I'd like instead eg:


square = function (int n) int {
return n * n;
}

Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-14 Thread Jérôme M. Berger
spir wrote:
 Actually, I have never been pleased that func defs (1) look like func
 calls (2) have an exceptional syntax compared to other definitions. I'd
 like instead eg:
 
 square = function (int n) int {
 return n * n;
 }
 
That is still different from other definitions where the type comes
first. But the following would work too:

function (int n) int square = {
   return n*n;
}

And both would be easier to parse to boot:) There are actually
languages out there with this kind of syntax.

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-14 Thread spir

On 04/14/2011 07:58 PM, Jérôme M. Berger wrote:

spir wrote:

Actually, I have never been pleased that func defs (1) look like func
calls (2) have an exceptional syntax compared to other definitions. I'd
like instead eg:

 square = function (int n) int {
 return n * n;
 }


That is still different from other definitions where the type comes
first.


True. I was firstly evoking the x = y form.


 But the following would work too:

function (int n) int square = {
return n*n;
}

And both would be easier to parse to boot:)


Yes, I like your format as well.


 There are actually
languages out there with this kind of syntax.


Yop, I know (my example was Lua-like: we are not reinventing the wheel ;-)

Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-13 Thread Bruno Medeiros

On 11/04/2011 20:54, Steven Schveighoffer wrote:

In most of the editors I use, the default is to use spaces for
indentation.  So what happens is someone opens a file that uses tabs for
indentation, then adds some lines.  However, their editor only uses
spaces *for those lines they added*, which results in a hybrid.
However, the person editing doesn't notice because it all lines up on
their screen.


Just FYI, in Eclipse, the auto-indentation that happen when you press 
Enter will use the indentation from the previous line (whether it's 
spaces, tabs, or even mixed).
However, other editing operations that generate lines of code (like code 
templates, auto-generated code, refactorings like extracting a method, 
etc.) are not so smart and will indent with according to the default 
indentation you specify in the settings, they won't look at how the file 
is already indented.



--
Bruno Medeiros - Software Engineer


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

2011-04-13 Thread Bruno Medeiros

On 11/04/2011 22:03, David Gileadi wrote:

On 4/11/11 1:51 PM, Jérôme M. Berger wrote:

Nick Sabalausky wrote:

Andrej Mitrovicandrej.mitrov...@gmail.com wrote in message
news:mailman.3396.1302548836.4748.digitalmar...@puremagic.com...

Smart editors also allow you to unindent with a single backspace
regardless if you're using tabs or spaces.


In other words, *some* editors handle space-indentation intelligently
(and
do so by reinventing *tabs*), while *all* editors handle tab-indentation
intelligently.


I have seen editors that would convert a tab to spaces and only
delete one space when hitting backspace ;)

Jerome


Eclipse, I'm looking at you!


In Eclipse you can press Shift-Tab to reduce the indentation by one 
level, regardless of whether it's using spaces or tabs. This also works 
if you have multiple lines of code selected in the editor. (so if you 
have 4 spaces of indentation and you press Shift-Tab anywhere on the 
line it will delete those 4 spaces, assuming you configured a level of 
indentation to be 4 spaces (that's usually the default though))


--
Bruno Medeiros - Software Engineer


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

2011-04-13 Thread Bruno Medeiros

On 12/04/2011 21:08, Nick Sabalausky wrote:

Jérôme M. Bergerjeber...@free.fr  wrote in message
news:io2396$1nuo$1...@digitalmars.com...

spir wrote:


A drawback is one cannot directly have different indent levels, for
instance to indent collection contents more, or less, than blocks of
code. This can also be considered an advantage; and is simply solved by
using... spaces ;-)

void f () {
  -  while (true) {
  -   -  table = [
  -   -  ..aaa : 1,
  -   -  ..bbb : 2,
  -   -  ..ccc : 3,
  -   -  ];
  -   -  auto a = this(table);
  -   -  if (! a) break;
  -  }
}

(yes, the example is stupid)


Unfortunately, most editors are completely unable to handle this
example properly: sure they will *display* it fine, but they will
not allow you to *enter* it right (especially if you need more
spaces for alignment than the tab size).





Why would editors not allow you to enter that right? I don't see what 
the problem would be, unless you configured your editor to replaces N 
spaces into a tab for indentation.




That's unfortunately true. I used to try to do that in cases like this:

if(blah)
{
-   foo(.bigLongArg1,
-   .bigLongArg2,
-   .bigLongArg3
-   );
}

But editors just choke on that like crazy. It's a pain to type it in that
way, and then when you go back to edit (add another arg on another line, for
instance), it just screws it all up again, likely without me even noticing
right away. (And I even have most auto-formatting turned off.) I decided it
was far more trouble than it was worth.



Works fine in Eclipse, again because when it auto-indents on Enter, it 
uses the indentation of the previous line. :)


--
Bruno Medeiros - Software Engineer


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

2011-04-13 Thread Jérôme M. Berger
Nick Sabalausky wrote:
 J�r�me M. Berger jeber...@free.fr wrote in message 
 news:io230l$1ldc$3...@digitalmars.com...
 Well, I have worked in both environments, and I have seen a lot
 more mess ups with tabs than with spaces... Other than that (and the
 fact that almost *no* editors are able to do it properly), I would
 really prefer tabs for indent, spaces for align.
 
 I prefer tabs for indent, tabs for align, spaces for separation, but that 
 requires elastic tabstops. And at least one of the biggest code-edit 
 controls out there (the one I use), Scintilla, doesn't support them :(
 
 
That depends what you mean by align. I agree that for the
following, elastic tab stops would be best:

int  a;
SomeType b;

However, for this, I think that spaces are better:

doSomething (someLongParameterThatJustifiesBreakingTheLine,
 someOtherLongParameterJustInCase);

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-13 Thread Nick Sabalausky
Jérôme M. Berger jeber...@free.fr wrote in message 
news:io4sng$1p9b$1...@digitalmars.com...
Nick Sabalausky wrote:
 J?r?me M. Berger jeber...@free.fr wrote in message
 news:io230l$1ldc$3...@digitalmars.com...
 Well, I have worked in both environments, and I have seen a lot
 more mess ups with tabs than with spaces... Other than that (and the
 fact that almost *no* editors are able to do it properly), I would
 really prefer tabs for indent, spaces for align.

 I prefer tabs for indent, tabs for align, spaces for separation, but 
 that
 requires elastic tabstops. And at least one of the biggest code-edit
 controls out there (the one I use), Scintilla, doesn't support them :(


 That depends what you mean by align. I agree that for the
following, elastic tab stops would be best:

int  a;
SomeType b;

 However, for this, I think that spaces are better:

doSomething (someLongParameterThatJustifiesBreakingTheLine,
 someOtherLongParameterJustInCase);

I guess we disagree on that. Like I said in another branch, I used to do 
that, but then I found that mixing tabs/spaces before the first 
non-whitespace on a line is just asking for trouble.

I'd rather do it like this (assuming elastic tabstops):

doSomething(-someLongParameterThatJustifiesBreakingTheLine,
-someOtherLongParameterJustInCase);

Of course, that does demonstrate that I've never liked putting any 
whitespace between a function name (or if/while/etc.) and the opening paren. 
YMMV.





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

2011-04-13 Thread Jérôme M. Berger
Nick Sabalausky wrote:
 J�r�me M. Berger jeber...@free.fr wrote in message 
 news:io4sng$1p9b$1...@digitalmars.com...
 Nick Sabalausky wrote:
 J?r?me M. Berger jeber...@free.fr wrote in message
 news:io230l$1ldc$3...@digitalmars.com...
 Well, I have worked in both environments, and I have seen a lot
 more mess ups with tabs than with spaces... Other than that (and the
 fact that almost *no* editors are able to do it properly), I would
 really prefer tabs for indent, spaces for align.
 I prefer tabs for indent, tabs for align, spaces for separation, but 
 that
 requires elastic tabstops. And at least one of the biggest code-edit
 controls out there (the one I use), Scintilla, doesn't support them :(


 That depends what you mean by align. I agree that for the
 following, elastic tab stops would be best:

 int  a;
 SomeType b;

 However, for this, I think that spaces are better:

 doSomething (someLongParameterThatJustifiesBreakingTheLine,
 someOtherLongParameterJustInCase);
 
 I guess we disagree on that. Like I said in another branch, I used to do 
 that, but then I found that mixing tabs/spaces before the first 
 non-whitespace on a line is just asking for trouble.
 
Yes, that is the main reason why I use spaces for indenting...

 I'd rather do it like this (assuming elastic tabstops):
 
 doSomething(-someLongParameterThatJustifiesBreakingTheLine,
 -someOtherLongParameterJustInCase);
 
 Of course, that does demonstrate that I've never liked putting any 
 whitespace between a function name (or if/while/etc.) and the opening paren. 
 YMMV.
 
Well, standard (printed) typographic practices put spaces outside
the parenthesis and none inside. And as opposed to a lot of
typographic rules, that one is a constant across languages and variants.

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-13 Thread Andrei Alexandrescu

On 4/13/11 4:17 PM, Jérôme M. Berger wrote:

Nick Sabalausky wrote:

J�r�me M. Bergerjeber...@free.fr  wrote in message
news:io4sng$1p9b$1...@digitalmars.com...

Nick Sabalausky wrote:

J?r?me M. Bergerjeber...@free.fr  wrote in message
news:io230l$1ldc$3...@digitalmars.com...

Well, I have worked in both environments, and I have seen a lot
more mess ups with tabs than with spaces... Other than that (and the
fact that almost *no* editors are able to do it properly), I would
really prefer tabs for indent, spaces for align.

I prefer tabs for indent, tabs for align, spaces for separation, but
that
requires elastic tabstops. And at least one of the biggest code-edit
controls out there (the one I use), Scintilla, doesn't support them :(



That depends what you mean by align. I agree that for the
following, elastic tab stops would be best:

int  a;
SomeType b;

However, for this, I think that spaces are better:

doSomething (someLongParameterThatJustifiesBreakingTheLine,
 someOtherLongParameterJustInCase);


I guess we disagree on that. Like I said in another branch, I used to do
that, but then I found that mixing tabs/spaces before the first
non-whitespace on a line is just asking for trouble.


Yes, that is the main reason why I use spaces for indenting...


I'd rather do it like this (assuming elastic tabstops):

doSomething(-someLongParameterThatJustifiesBreakingTheLine,
- someOtherLongParameterJustInCase);

Of course, that does demonstrate that I've never liked putting any
whitespace between a function name (or if/while/etc.) and the opening paren.
YMMV.


Well, standard (printed) typographic practices put spaces outside
the parenthesis and none inside. And as opposed to a lot of
typographic rules, that one is a constant across languages and variants.


Math typography rules also preclude inserting a space between a 
function's name and the opening brace. That's why I consistently go with 
no space after the opening paren or before the closing paren. Also, 
that's why there's no need to make if (condition) and func(args) 
consistent with regard to space before opening paren. In the first case 
the paren is pure punctuation; in the latter it is an organic part of 
the function invocation syntax. So one should never leave a space 
between function name and opening paren, and decide independently 
regarding the existence of a space between if/while etc. and the opening 
paren.



Andrei


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

2011-04-13 Thread Jussi Jumppanen
Bruno Medeiros Wrote:

 Why would editors not allow you to enter that right? 

I was wondering the same thing?

 Works fine in Eclipse, again because when it auto-indents on Enter, it 
 uses the indentation of the previous line. :)

It also worked fine in Zeus, because it too uses this same Enter key logic.



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

2011-04-12 Thread Jacob Carlborg

On 2011-04-11 22:09, Nick Sabalausky wrote:

Jonathan M Davisjmdavisp...@gmx.com  wrote in message
news:mailman.3371.1302508910.4748.digitalmar...@puremagic.com...

Jonathan M Davis Wrote:

Personally, I think that it's _horrible_ to use tabs


Why would one fear tabs?


They change depending on your editor settings. Indenting gets screwed up
if
tabs and spaces are mixed. It's just plain annoying to have an indentation
of
multiple spaces which isn't actually multiple spaces.

The biggest problem though is that it just totally screws with indentation
if
tabs and spaces are mixed and that invariably happens.



You're drawing a completely invalid conclusion from that, because it works
the same both ways. If I have a bunch of code indented with spaces, all it
takes is a few things to be indented with tabs instead to create the *exact
same screwup*. You've chosen tabs as the villian completely arbitrarily.

Also I find your argument that the mixup is significantly more likely when
tabs are used for indentation to be extremely questionable. You admit
yourself that you've rarely come across situations where tabs are the
default. So how would you know? Based on that *one* piece of anecdotal
evidence? And even that can be suspect, because if you were involved, we
know you're accustomed to using spaces for indentation, so that could very
well have been the reason for the mixup.

I have worked with code that used spaces as indentation on various
occasions, and I always did wind up accidentally sticking some tabs in
there. So I know first hand that the idea of the mixups not happening with
space-indentation is a load of crap. They're equally likely.

And as far as needing to use spaces in code anyway: That's not remotely a
problem. People know damn well the difference between a space and
indentation. Fuck, if MS Word users can figure it out, so can programmers.


Tabs serve no useful purpose IMHO.



Well, IMO, using spaces for indentation serves no useful purpose. At least
tabs actually *mean* alignment and indentation. Spaces don't and never have.
Plus, what's the use of being able place the cursor at arbtrary points
within the 4 spaces (or 8 spaces, or whatever)? All it does is make me
have to press left/right-arrow-key a whole hell of a lot more (which I
really do find to be a PITA). And makes it easier to accidentally end up
with a messed up indentation of +/- 1 space somewhere. Spaces for
indentation is just a misuse and a kludge to force on each other the
idiologies of how large indentation should be.


So true.

--
/Jacob Carlborg


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

2011-04-12 Thread spir

On 04/12/2011 05:15 AM, Jonathan M Davis wrote:

So, how you format
your code matters. Using tabs screws with that unless you're completely
consistent, and while a single developer may be consistent, groups of
developers rarely are.


This is as true in the case of spaces. With the additional issue of 
indent-width.

Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-12 Thread spir

On 04/12/2011 05:19 AM, Jonathan M Davis wrote:

Using only spaces and no tabs avoids the entire issue


spaces -- tabs works as fine

Why are programmers so blindly unfair when discussing this point?


and is one of the major reasons (if not _the_ major reason) why it is 
incredibly common for coding
standards to require spaces and prohibit tabs. Obviously, you _can_ use tabs if 
you're careful - especially if you're the only programmer involved - but it's 
just simpler to disallow tabs when you're dealing with a group of developers.


I guess the true reason why spaces are required in guidelines is a mix of 
conformism and virality. At one point in time, people started to face the 
issue, thay had to make a choice for coding standard in language libs, 
corporation code, school/university works, etc. They chose spaces because, at 
that time, most people used spaces and did not want to change. Then, even more 
programmers get used to use spaces and don't want to change, so that new coding 
standards are forced to enforce spaces, and so on...
There is no, and there has never been any, logical reason for this choice. 
There cannot be, in fact:


1. Tabs properly separate code content from view,
2. and respect each reader's preference.

In addition to those main reasons, they have a few nice side-effects:

* No indent width issue (!),
* 1 tab -- 1 indent level conceptually,
* deletion is 1 key press, even with stupid editors.

A drawback is one cannot directly have different indent levels, for instance to 
indent collection contents more, or less, than blocks of code. This can also be 
considered an advantage; and is simply solved by using... spaces ;-)


void f () {
 - while (true) {
 -  - table = [
 -  - ..aaa : 1,
 -  - ..bbb : 2,
 -  - ..ccc : 3,
 -  - ];
 -  - auto a = this(table);
 -  - if (! a) break;
 - }
}

(yes, the example is stupid)

Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-12 Thread spir

On 04/12/2011 07:13 AM, Jonathan M Davis wrote:

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.


How can you assert that? you stated yourself that in all your work environments 
the convention was spaces. So, logically, all mess up cases you have ever 
experienced are due to the standard beeing spaces.

Your assertion about tab-as-standard causing more mess up is complete guessing.
Please, be fair.

Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-12 Thread spir

On 04/12/2011 09:24 AM, Jacob Carlborg wrote:

Well, IMO, using spaces for indentation serves no useful purpose. At least
tabs actually *mean* alignment and indentation. Spaces don't and never have.
Plus, what's the use of being able place the cursor at arbtrary points
within the 4 spaces (or 8 spaces, or whatever)? All it does is make me
have to press left/right-arrow-key a whole hell of a lot more (which I
really do find to be a PITA). And makes it easier to accidentally end up
with a messed up indentation of +/- 1 space somewhere. Spaces for
indentation is just a misuse and a kludge to force on each other the
idiologies of how large indentation should be.


So true.


Especially Spaces for indentation is just a misuse. Space are not meant for 
alignment, have never been, and should never have been used for that. Tabs are 
intended for that role,  they play it well.


Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-12 Thread Jacob Carlborg

On 2011-04-12 05:19, Jonathan M Davis wrote:

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.


How can it not be as easy to use tabs without realizing that someone 
else used spaces?



Using only spaces and no tabs avoids the entire issue and is one of the major
reasons (if not _the_ major reason) why it is incredibly common for coding
standards to require spaces and prohibit tabs. Obviously, you _can_ use tabs
if you're careful - especially if you're the only programmer involved - but
it's just simpler to disallow tabs when you're dealing with a group of
developers.

- Jonathan M Davis



--
/Jacob Carlborg


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

2011-04-12 Thread Kagamin
David Gileadi Wrote:

  I have seen editors that would convert a tab to spaces and only
  delete one space when hitting backspace ;)
 
  Jerome
 
 Eclipse, I'm looking at you!

Also Visual Studio and I don't see the delete unindents option.


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

2011-04-12 Thread Jérôme M. Berger
Jérôme M. Berger wrote:
 Nick Sabalausky wrote:
 Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message 
 news:mailman.3396.1302548836.4748.digitalmar...@puremagic.com...
 Smart editors also allow you to unindent with a single backspace
 regardless if you're using tabs or spaces.
 In other words, *some* editors handle space-indentation intelligently (and 
 do so by reinventing *tabs*), while *all* editors handle tab-indentation 
 intelligently.

   I have seen editors that would convert a tab to spaces and only
 delete one space when hitting backspace ;)
 
Reading myself, I realise that I was not perfectly clear: the
editor would accept the tab and insert a tab character, it is only
when hitting backspace after a tab that the editor would convert the
tab to N-1 space (assuming tabs are equivalent to N spaces).

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-12 Thread Jérôme M. Berger
spir wrote:
 On 04/12/2011 07:13 AM, Jonathan M Davis wrote:
 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.
 
 How can you assert that? you stated yourself that in all your work
 environments the convention was spaces. So, logically, all mess up cases
 you have ever experienced are due to the standard beeing spaces.
 Your assertion about tab-as-standard causing more mess up is complete
 guessing.
 Please, be fair.
 
Well, I have worked in both environments, and I have seen a lot
more mess ups with tabs than with spaces... Other than that (and the
fact that almost *no* editors are able to do it properly), I would
really prefer tabs for indent, spaces for align.

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-12 Thread Jérôme M. Berger
spir wrote:
 In addition to those main reasons, they have a few nice side-effects:
 
 * No indent width issue (!),
True

 * 1 tab -- 1 indent level conceptually,
True

 * deletion is 1 key press, even with stupid editors.
False, not with some *really* stupid editors I have seen (!)

 
 A drawback is one cannot directly have different indent levels, for
 instance to indent collection contents more, or less, than blocks of
 code. This can also be considered an advantage; and is simply solved by
 using... spaces ;-)
 
 void f () {
  - while (true) {
  -  - table = [
  -  - ..aaa : 1,
  -  - ..bbb : 2,
  -  - ..ccc : 3,
  -  - ];
  -  - auto a = this(table);
  -  - if (! a) break;
  - }
 }
 
 (yes, the example is stupid)
 
Unfortunately, most editors are completely unable to handle this
example properly: sure they will *display* it fine, but they will
not allow you to *enter* it right (especially if you need more
spaces for alignment than the tab size).

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-12 Thread Nick Sabalausky
Cliff Hudson cliff.s.hud...@gmail.com wrote in message 
news:mailman.3414.1302586393.4748.digitalmar...@puremagic.com...
 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.


I'd rather my text show up indented the way the person reading it desires.

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


Pico rules them all! ;)




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

2011-04-12 Thread Nick Sabalausky
Jérôme M. Berger jeber...@free.fr wrote in message 
news:io230l$1ldc$3...@digitalmars.com...
Well, I have worked in both environments, and I have seen a lot
more mess ups with tabs than with spaces... Other than that (and the
fact that almost *no* editors are able to do it properly), I would
really prefer tabs for indent, spaces for align.

I prefer tabs for indent, tabs for align, spaces for separation, but that 
requires elastic tabstops. And at least one of the biggest code-edit 
controls out there (the one I use), Scintilla, doesn't support them :(




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

2011-04-12 Thread Nick Sabalausky
Jérôme M. Berger jeber...@free.fr wrote in message 
news:io2396$1nuo$1...@digitalmars.com...
spir wrote:

 A drawback is one cannot directly have different indent levels, for
 instance to indent collection contents more, or less, than blocks of
 code. This can also be considered an advantage; and is simply solved by
 using... spaces ;-)

 void f () {
  - while (true) {
  -  - table = [
  -  - ..aaa : 1,
  -  - ..bbb : 2,
  -  - ..ccc : 3,
  -  - ];
  -  - auto a = this(table);
  -  - if (! a) break;
  - }
 }

 (yes, the example is stupid)

Unfortunately, most editors are completely unable to handle this
example properly: sure they will *display* it fine, but they will
not allow you to *enter* it right (especially if you need more
spaces for alignment than the tab size).


That's unfortunately true. I used to try to do that in cases like this:

if(blah)
{
-  foo(.bigLongArg1,
-  .bigLongArg2,
-  .bigLongArg3
-  );
}

But editors just choke on that like crazy. It's a pain to type it in that 
way, and then when you go back to edit (add another arg on another line, for 
instance), it just screws it all up again, likely without me even noticing 
right away. (And I even have most auto-formatting turned off.) I decided it 
was far more trouble than it was worth.

So I've changed my style to this:

if(blah)
{
-  foo(
-  -  bigLongArg1,
-  -  bigLongArg2,
-  -  bigLongArg3
-  );
}

Much better. Of course, it would be even better still if Scintilla would be 
willing to add elastic tabstops (I'm getting increasingly annoyed that it 
doesn't, and that it doesn't even seem receptive to the idea, for technical 
reasons), because then I *could* do exactly what I used to with absolutely 
no problem:

if(blah)
{
-  foo(-bigLongArg1,
-  -bigLongArg2,
-  -bigLongArg3
-  );
}

And everything would always align properly.




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

2011-04-12 Thread Adam D. Ruppe
Nick Sabalausky wrote:
 So I've changed my style to this:

 if(blah)
 {
 -  foo(
 -  -  bigLongArg1,
 -  -  bigLongArg2,
 -  -  bigLongArg3
 -  );
 }

That's something I've started doing too. It's not just a matter
of alignment either - I think the first argument on the same
line as the function name is easy to miss. It all blends in
together.


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

2011-04-12 Thread Kagamin
Nick Sabalausky Wrote:

 So I've changed my style to this:
 
 if(blah)
 {
 -  foo(
 -  -  bigLongArg1,
 -  -  bigLongArg2,
 -  -  bigLongArg3
 -  );
 }
 
 Much better. Of course, it would be even better still if Scintilla would be 
 willing to add elastic tabstops (I'm getting increasingly annoyed that it 
 doesn't, and that it doesn't even seem receptive to the idea, for technical 
 reasons), because then I *could* do exactly what I used to with absolutely 
 no problem:

Scintilla has 3 word wrapping modes, so long lines should not be a problem.


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

2011-04-12 Thread spir

On 04/12/2011 10:08 PM, Nick Sabalausky wrote:

Jérôme M. Bergerjeber...@free.fr  wrote in message
news:io2396$1nuo$1...@digitalmars.com...

spir wrote:


A drawback is one cannot directly have different indent levels, for
instance to indent collection contents more, or less, than blocks of
code. This can also be considered an advantage; and is simply solved by
using... spaces ;-)

void f () {
  -  while (true) {
  -   -  table = [
  -   -  ..aaa : 1,
  -   -  ..bbb : 2,
  -   -  ..ccc : 3,
  -   -  ];
  -   -  auto a = this(table);
  -   -  if (! a) break;
  -  }
}

(yes, the example is stupid)


Unfortunately, most editors are completely unable to handle this
example properly: sure they will *display* it fine, but they will
not allow you to *enter* it right (especially if you need more
spaces for alignment than the tab size).



That's unfortunately true.


Strange... did not know that, but I have only used geany for a while already.

Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-12 Thread Jonathan M Davis
 On 2011-04-12 05:19, Jonathan M Davis wrote:
  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.
 
 How can it not be as easy to use tabs without realizing that someone
 else used spaces?

Oh, it can be. But what generally happens in environments where spaces are 
required is that everyone sets up their editors to insert spaces when you hit 
the tab key instead of a tab (if everyone is using a common IDE, it's probably
even required), so it becomes pretty much impossible to enter tabs by accident,
whereas in an environment where tabs are used, you're not going to disable the
spacebar, so spaces can still be inserted. So, generally, in a spaces-only
environment, you don't run into problems with tabs.

- Jonathan M Davis


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

2011-04-11 Thread Daniel Gibson
Am 11.04.2011 07:51, schrieb Jonathan M Davis:
 Nick Sabalausky:
 What, so that he can force his indentation size on everyone else that
 works on the code? Or so that using the left/right arrow keys within the
 indentation zone requires an unnessesaraly large number of keypresses?

 It's a module theoretically meant for Phobos, and the Phobos coding
 standard are spaces.
 
 Yes. Phobos follows the convention of indenting with spaces and that levels 
 of 
 indentation are 4 spaces. So, anything which goes into Phobos needs to follow 
 this convention.
 
 the only way that tabs work is if you use them consistently, which in my 
 experience almost never happens. 

How can people mess that up?

 And pretty much everywhere that I've worked 
 has required that spaces be used and no tabs. When people _have_ used tabs, 
 it's been a mess. Personally, I'm completely against using tabs in source 
 code.
 
 Regardless, Phobos doesn't use tabs. So, whatever someone may prefer in their 
 own code, code that they intend to get into Phobos shouldn't use tabs.
 
 - Jonathan M Davis

Of course there's always the possibility to use a code-beautifier to fix
this when you're done writing, like http://uncrustify.sourceforge.net/
which even officially supports D.

Cheers,
- Daniel


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

2011-04-11 Thread Jonathan M Davis
 Am 11.04.2011 07:51, schrieb Jonathan M Davis:
  Nick Sabalausky:
  What, so that he can force his indentation size on everyone else that
  works on the code? Or so that using the left/right arrow keys within
  the indentation zone requires an unnessesaraly large number of
  keypresses?
  
  It's a module theoretically meant for Phobos, and the Phobos coding
  standard are spaces.
  
  Yes. Phobos follows the convention of indenting with spaces and that
  levels of indentation are 4 spaces. So, anything which goes into Phobos
  needs to follow this convention.
  
  the only way that tabs work is if you use them consistently, which in my
  experience almost never happens.
 
 How can people mess that up?

They mix tabs and spaces. On some lines, they use spaces and on others they 
use tabs. If the tab size isn't set exactly the same on your machine as 
however it was set up on the other person's machine, then the indentation is 
totally screwed up. And if multiple people have edited the file, it gets that 
much worse. On top of that, even if the rule is to use tabs for indentation 
and spaces elsewhere and people are consistent with tabs for indentation, 
they'll often use tabs elswhere where they should have used spaces. The only 
way that using tabs works is if you're completely consistent with them. You 
use tabs where you're supposed to use tabs and spaces where you're supposed to 
use spaces, and everyone does the same thing. Odds are, that's not going to 
happen - _especially_ if the tabs don't show up differently in your editor and 
you can't see when you've screwed up and used tabs when you're not supposed to 
or not used them where you are supposed to.

Personally, I think that it's _horrible_ to use tabs, and I know plenty of 
programmers who agree, but as with many stylistic things in programming, there 
are plenty who would disagree.

- Jonathan M Davis


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

2011-04-11 Thread bearophile
Jonathan M Davis:

 Yes. Phobos follows the convention of indenting with spaces and that levels 
 of 
 indentation are 4 spaces. So, anything which goes into Phobos needs to follow 
 this convention.
 ...
 Regardless, Phobos doesn't use tabs. So, whatever someone may prefer in their 
 own code, code that they intend to get into Phobos shouldn't use tabs.

If you allow me, I have a stylistic suggestion for your posts, that I usually 
appreciate: in a single post don't repeat two times most of the things you want 
to say, once is enough :-)

Bye,
bearophile


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

2011-04-11 Thread Kagamin
Daniel Gibson Wrote:

  the only way that tabs work is if you use them consistently, which in my 
  experience almost never happens. 
 
 How can people mess that up?

They're CHAOTIC EVIL programmers! They can mess anything.

 Of course there's always the possibility to use a code-beautifier to fix
 this when you're done writing, like http://uncrustify.sourceforge.net/
 which even officially supports D.

If they can't get tabs right, how can they use beautifiers? They just write and 
commit.


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

2011-04-11 Thread Kagamin
Jonathan M Davis Wrote:

 Personally, I think that it's _horrible_ to use tabs

Why would one fear tabs?


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

2011-04-11 Thread Jonathan M Davis
 Jonathan M Davis Wrote:
  Personally, I think that it's _horrible_ to use tabs
 
 Why would one fear tabs?

They change depending on your editor settings. Indenting gets screwed up if 
tabs and spaces are mixed. It's just plain annoying to have an indentation of 
multiple spaces which isn't actually multiple spaces.

The biggest problem though is that it just totally screws with indentation if 
tabs and spaces are mixed and that invariably happens.

Tabs serve no useful purpose IMHO.

- Jonathan M Davis


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

2011-04-11 Thread Daniel Gibson

Am 11.04.2011 10:01, schrieb Jonathan M Davis:

Jonathan M Davis Wrote:

Personally, I think that it's _horrible_ to use tabs


Why would one fear tabs?


They change depending on your editor settings. Indenting gets screwed up if
tabs and spaces are mixed. It's just plain annoying to have an indentation of
multiple spaces which isn't actually multiple spaces.

The biggest problem though is that it just totally screws with indentation if
tabs and spaces are mixed and that invariably happens.

Tabs serve no useful purpose IMHO.

- Jonathan M Davis


So tabs are horrible because some people use spaces instead of tabs.


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

2011-04-11 Thread Jonathan M Davis
 Am 11.04.2011 10:01, schrieb Jonathan M Davis:
  Jonathan M Davis Wrote:
  Personally, I think that it's _horrible_ to use tabs
  
  Why would one fear tabs?
  
  They change depending on your editor settings. Indenting gets screwed up
  if tabs and spaces are mixed. It's just plain annoying to have an
  indentation of multiple spaces which isn't actually multiple spaces.
  
  The biggest problem though is that it just totally screws with
  indentation if tabs and spaces are mixed and that invariably happens.
  
  Tabs serve no useful purpose IMHO.
  
  - Jonathan M Davis
 
 So tabs are horrible because some people use spaces instead of tabs.

I hate the very concept of tabs to begin with. The fact that they're variable 
in size is _not_ something that I find to be desirable. Regardless of that 
however, if you try and use tabs for indentation they invariably get mixed 
with spaces, totally ruining whatever usefulness the tabs might have had. Code 
will _always_ contain spaces. You can't reasonably write code with only tabs. 
However, you _can_ easily and reasonably write code without tabs. Most code 
editors can be set up such that all tabs are converted to spaces. So, if you 
use only spaces, you can easily avoid the problem of tabs and spaces being 
mixed. On the other hand, you _can't_ do the same by using only tabs. So, if 
you do use tabs, you will end up with mixed tabs and spaces unless everyone 
involved is very careful, which isn't going to happen.

So, I suppose that you could say that tabs are horrible because some people 
use spaces, but I don't see any value in them to begin with anyway. However, 
the fact that you invariably end up with mixed tabs and spaces when you try 
and use tabs makes tabs completely useless. Every place that I've ever worked 
at has gone for spaces only, and I've only ever heard of one place where it 
was required that tabs be used for indentation. I'm sure that there are 
others, but it's rare that I've heard of anyone thinking that using tabs in 
code was a good idea.

- Jonathan M Davis


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

2011-04-11 Thread spir

On 04/11/2011 07:51 AM, Jonathan M Davis wrote:

the only way that tabs work is if you use them consistently, which in my
experience almost never happens. And


How so? If you probably set your editor, inconsistency simply cannot happen... 
The same is true for using spaces, anyway.


Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-11 Thread spir

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.


Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-11 Thread spir

On 04/11/2011 10:01 AM, Jonathan M Davis wrote:

Jonathan M Davis Wrote:

Personally, I think that it's _horrible_ to use tabs


  Why would one fear tabs?

They change depending on your editor settings.


That's precisely what they are meant for... unlike space-indentation, 
tab-indentation respects you :-)
Using spaces for indent is using *content* to describe *display*. It's messing 
up model with view, just like using b instead of strong.


Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-11 Thread Kagamin
Jonathan M Davis Wrote:

 So, if 
 you do use tabs, you will end up with mixed tabs and spaces unless everyone 
 involved is very careful, which isn't going to happen.

If no one is careful, you end up with mixed tabs and spaces, no matter what 
policies you're trying to enforce.


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

2011-04-11 Thread Kagamin
Jonathan M Davis Wrote:

 Every place that I've ever worked 
 at has gone for spaces only, and I've only ever heard of one place where it 
 was required that tabs be used for indentation. I'm sure that there are 
 others, but it's rare that I've heard of anyone thinking that using tabs in 
 code was a good idea.

People often follow wrong traditions blindly.


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

2011-04-11 Thread Adam D. Ruppe
bearophile:
 It's a module theoretically meant for Phobos, and the Phobos coding
 standard are spaces.

Yeah, that's all that matters in the end. When in Rome...

But it's trivial to do a find and replace all before submitting so
really, it's just not a big deal.


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

2011-04-11 Thread Andrei Alexandrescu

On 4/11/11 10:30 AM, Kagamin wrote:

Jonathan M Davis Wrote:


Every place that I've ever worked
at has gone for spaces only, and I've only ever heard of one place where it
was required that tabs be used for indentation. I'm sure that there are
others, but it's rare that I've heard of anyone thinking that using tabs in
code was a good idea.


People often follow wrong traditions blindly.


That is actually very true about tab. It's a straight carryover from 
typing machines that has no justification today.


Andrei


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

2011-04-11 Thread Kagamin
Andrei Alexandrescu Wrote:

 That is actually very true about tab. It's a straight carryover from 
 typing machines that has no justification today.

If it's useful, it doesn't matter, where it came from.


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

2011-04-11 Thread spir

On 04/11/2011 05:31 PM, Adam D. Ruppe wrote:

bearophile:

It's a module theoretically meant for Phobos, and the Phobos coding
standard are spaces.


Yeah, that's all that matters in the end. When in Rome...

But it's trivial to do a find and replace all before submitting so
really, it's just not a big deal.


Smart editors actually differentiate between indentation and spacing elsewhere 
(meaning they won't mess up with spacing inline / in comments / docs / strings).


Denis
--
_
vita es estrany
spir.wikidot.com



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

2011-04-11 Thread Andrej Mitrovic
Smart editors also allow you to unindent with a single backspace
regardless if you're using tabs or spaces.


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

2011-04-11 Thread Steven Schveighoffer

On Mon, 11 Apr 2011 06:17:58 -0400, spir denis.s...@gmail.com wrote:


On 04/11/2011 07:51 AM, Jonathan M Davis wrote:

the only way that tabs work is if you use them consistently, which in my
experience almost never happens. And


How so? If you probably set your editor, inconsistency simply cannot  
happen... The same is true for using spaces, anyway.


Don't want to get too much into this obviously polarized debate, but in my  
experience, people vary as much as editors.  And editors vary quite a bit.


In most of the editors I use, the default is to use spaces for  
indentation.  So what happens is someone opens a file that uses tabs for  
indentation, then adds some lines.  However, their editor only uses spaces  
*for those lines they added*, which results in a hybrid.  However, the  
person editing doesn't notice because it all lines up on their screen.


You may have philosophical objections to all of this, but this answers  
your question straightforwardly -- it happens, all the time, and this is  
how.


The easiest rule to follow is -- always use spaces to indent.  Almost all  
editors support this (and are set to this by default).  Almost all editors  
provide some sort of auto-indentation, or some command to indent a  
highlighted section of code.  The oh crap, now I have to go back through  
and convert tabs to spaces argument just isn't valid anymore.


-Steve


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

2011-04-11 Thread Nick Sabalausky
Jonathan M Davis jmdavisp...@gmx.com wrote in message 
news:mailman.3371.1302508910.4748.digitalmar...@puremagic.com...
 Jonathan M Davis Wrote:
  Personally, I think that it's _horrible_ to use tabs

 Why would one fear tabs?

 They change depending on your editor settings. Indenting gets screwed up 
 if
 tabs and spaces are mixed. It's just plain annoying to have an indentation 
 of
 multiple spaces which isn't actually multiple spaces.

 The biggest problem though is that it just totally screws with indentation 
 if
 tabs and spaces are mixed and that invariably happens.


You're drawing a completely invalid conclusion from that, because it works 
the same both ways. If I have a bunch of code indented with spaces, all it 
takes is a few things to be indented with tabs instead to create the *exact 
same screwup*. You've chosen tabs as the villian completely arbitrarily.

Also I find your argument that the mixup is significantly more likely when 
tabs are used for indentation to be extremely questionable. You admit 
yourself that you've rarely come across situations where tabs are the 
default. So how would you know? Based on that *one* piece of anecdotal 
evidence? And even that can be suspect, because if you were involved, we 
know you're accustomed to using spaces for indentation, so that could very 
well have been the reason for the mixup.

I have worked with code that used spaces as indentation on various 
occasions, and I always did wind up accidentally sticking some tabs in 
there. So I know first hand that the idea of the mixups not happening with 
space-indentation is a load of crap. They're equally likely.

And as far as needing to use spaces in code anyway: That's not remotely a 
problem. People know damn well the difference between a space and 
indentation. Fuck, if MS Word users can figure it out, so can programmers.

 Tabs serve no useful purpose IMHO.


Well, IMO, using spaces for indentation serves no useful purpose. At least 
tabs actually *mean* alignment and indentation. Spaces don't and never have. 
Plus, what's the use of being able place the cursor at arbtrary points 
within the 4 spaces (or 8 spaces, or whatever)? All it does is make me 
have to press left/right-arrow-key a whole hell of a lot more (which I 
really do find to be a PITA). And makes it easier to accidentally end up 
with a messed up indentation of +/- 1 space somewhere. Spaces for 
indentation is just a misuse and a kludge to force on each other the 
idiologies of how large indentation should be.





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

2011-04-11 Thread Nick Sabalausky
Kagamin s...@here.lot wrote in message 
news:inv6q0$1hmi$1...@digitalmars.com...
 Jonathan M Davis Wrote:

 Every place that I've ever worked
 at has gone for spaces only, and I've only ever heard of one place where 
 it
 was required that tabs be used for indentation. I'm sure that there are
 others, but it's rare that I've heard of anyone thinking that using tabs 
 in
 code was a good idea.

 People often follow wrong traditions blindly.

Especially in corporations.




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

2011-04-11 Thread Nick Sabalausky
Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message 
news:mailman.3396.1302548836.4748.digitalmar...@puremagic.com...
 Smart editors also allow you to unindent with a single backspace
 regardless if you're using tabs or spaces.

In other words, *some* editors handle space-indentation intelligently (and 
do so by reinventing *tabs*), while *all* editors handle tab-indentation 
intelligently.




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

2011-04-11 Thread Jérôme M. Berger
Nick Sabalausky wrote:
 Andrej Mitrovic andrej.mitrov...@gmail.com wrote in message 
 news:mailman.3396.1302548836.4748.digitalmar...@puremagic.com...
 Smart editors also allow you to unindent with a single backspace
 regardless if you're using tabs or spaces.
 
 In other words, *some* editors handle space-indentation intelligently (and 
 do so by reinventing *tabs*), while *all* editors handle tab-indentation 
 intelligently.
 
I have seen editors that would convert a tab to spaces and only
delete one space when hitting backspace ;)

Jerome
-- 
mailto:jeber...@free.fr
http://jeberger.free.fr
Jabber: jeber...@jabber.fr



signature.asc
Description: OpenPGP digital signature


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

2011-04-11 Thread David Gileadi

On 4/11/11 1:51 PM, Jérôme M. Berger wrote:

Nick Sabalausky wrote:

Andrej Mitrovicandrej.mitrov...@gmail.com  wrote in message
news:mailman.3396.1302548836.4748.digitalmar...@puremagic.com...

Smart editors also allow you to unindent with a single backspace
regardless if you're using tabs or spaces.


In other words, *some* editors handle space-indentation intelligently (and
do so by reinventing *tabs*), while *all* editors handle tab-indentation
intelligently.


I have seen editors that would convert a tab to spaces and only
delete one space when hitting backspace ;)

Jerome


Eclipse, I'm looking at you!


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

2011-04-11 Thread Daniel Gibson
Am 11.04.2011 17:25, schrieb Kagamin:
 Jonathan M Davis Wrote:
 
 So, if 
 you do use tabs, you will end up with mixed tabs and spaces unless everyone 
 involved is very careful, which isn't going to happen.
 
 If no one is careful, you end up with mixed tabs and spaces, no matter what 
 policies you're trying to enforce.

This is a good point.


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

2011-04-11 Thread Daniel Gibson
Am 11.04.2011 23:03, schrieb David Gileadi:
 On 4/11/11 1:51 PM, Jérôme M. Berger wrote:
 Nick Sabalausky wrote:
 Andrej Mitrovicandrej.mitrov...@gmail.com  wrote in message
 news:mailman.3396.1302548836.4748.digitalmar...@puremagic.com...
 Smart editors also allow you to unindent with a single backspace
 regardless if you're using tabs or spaces.

 In other words, *some* editors handle space-indentation intelligently
 (and
 do so by reinventing *tabs*), while *all* editors handle tab-indentation
 intelligently.

 I have seen editors that would convert a tab to spaces and only
 delete one space when hitting backspace ;)

 Jerome
 
 Eclipse, I'm looking at you!

By default Eclipse doesn't convert tab to spaces, though.


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

2011-04-11 Thread Andrej Mitrovic
DigitalMarsTV Headlines:
Newlines: Why is Microsoft still ignoring the public's demand to
eliminate the carriage return?
Breaking News: Police investigators are on the lookout for the
monster lunatic who originally designed the number system layout for
PC-keyboards. As a reminder for the viewers just tuning in, the
suspect is charged with felonies in regards to the following Laws: 1.
By Law, numbers shall always start from digit zero. 2. By Law,
Function Keys shall be vertically aligned against number keys, so as
to have the same order as the number keys. The authorities are asking
for anyone with information on the suspect to come forward and send an
e-mail to protect_our_gnufree...@gnu.org


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

2011-04-11 Thread Jonathan M Davis
 On 04/11/2011 10:01 AM, Jonathan M Davis wrote:
  Jonathan M Davis Wrote:
  Personally, I think that it's _horrible_ to use tabs

Why would one fear tabs?
  
  They change depending on your editor settings.
 
 That's precisely what they are meant for... unlike space-indentation,
 tab-indentation respects you :-)
 Using spaces for indent is using *content* to describe *display*. It's
 messing up model with view, just like using b instead of strong.

I don't believe that the model-view issue really applies to code. For that to 
work, the model and view would have to be truly separate, and they aren't. 
Editors would have to understand the language and be able to format it based 
on what you wanted, then you could format code however you liked without 
affecting anyone else. But things just don't work that way. So, how you format 
your code matters. Using tabs screws with that unless you're completely 
consistent, and while a single developer may be consistent, groups of 
developers rarely are.

- Jonathan M Davis


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

2011-04-11 Thread Jonathan M Davis
 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.

Using only spaces and no tabs avoids the entire issue and is one of the major 
reasons (if not _the_ major reason) why it is incredibly common for coding 
standards to require spaces and prohibit tabs. Obviously, you _can_ use tabs 
if you're careful - especially if you're the only programmer involved - but 
it's just simpler to disallow tabs when you're dealing with a group of 
developers.

- Jonathan M Davis


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

2011-04-11 Thread Daniel Gibson
Am 12.04.2011 05:15, schrieb Jonathan M Davis:
 Using tabs screws with that unless you're completely 
 consistent, and while a single developer may be consistent, groups of 
 developers rarely are.
 
 - Jonathan M Davis

Yeah that is why using spaces screws with that: While a single developer
may be consistent, groups of developers rarely are.
So there may be a developer who uses tabs instead of spaces (maybe
because he thinks his editor will convert the tabs to spaces but he
forgot to check that option in the editors settings)..
And of course then there's that guy who uses two spaces instead of four
(or whatever the convention is), at least from a level of 3 indentations
on, to save space on the screen.
And this other guy who uses eight spaces in his performance critical
code because he thinks that'll prevent unnecessary nesting..
So much for consistency.

As someone else said before: This argument works for both directions.

Cheers,
- Daniel


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

2011-04-11 Thread Nick Sabalausky
Jonathan M Davis jmdavisp...@gmx.com wrote in message 
news:mailman.3412.1302578409.4748.digitalmar...@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.




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

2011-04-11 Thread Jonathan M Davis
 Jonathan M Davis jmdavisp...@gmx.com wrote in message
 news:mailman.3412.1302578409.4748.digitalmar...@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


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

2011-04-11 Thread Cliff Hudson
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 jmdavisp...@gmx.comwrote:

  Jonathan M Davis jmdavisp...@gmx.com wrote in message
  news:mailman.3412.1302578409.4748.digitalmar...@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



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

2011-04-11 Thread Andrej Mitrovic
On 4/12/11, Cliff Hudson cliff.s.hud...@gmail.com wrote:
 Perhaps we
 should do VI vs. EMACS while we are at it.

Don't bring operating systems into this...



... just kidding. :P


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

2011-04-10 Thread Nick Sabalausky
KennyTM~ kenn...@gmail.com wrote in message 
news:int88l$uaf$1...@digitalmars.com...
 On Apr 9, 11 04:26, Adam D. Ruppe wrote:
 We discussed this first in the GUI library thread, but since it
 meandered so much, I decided to split off into a new subject. Much
 of what I say here will be old to anyone who saw the previous thread.
 There's some new stuff nearer to the bottom though.

 I, with input from others, have started writing a little module
 for simple uses of a display. You can write to a bitmap, display it
 to a window, and handle events all in an easy way. The basics are
 cross platform, but you can use native function calls too.

 http://arsdnet.net/dcode/simpledisplay.d

 It's still very much in progress, but I think it's now at the point
 where the direction I'm taking it is clear.

 [snip]

 Thanks for the great work!

 Taking the version on that link, I have ported it to use the native 
 Cocoa/Core Graphics in OS X, instead of X11. You can check out the diff in 
 https://github.com/kennytm/simpledisplay.d/commit/a790.

 Only Snow Leopard (10.6) is supported.

 I have only tested that it works on the pendulum example and the HSL 
 picker, so things like drawText and drawPixel may not work properly yet. 
 The implementation part is quite messy right now due to Objective-C.

 Since dmd does not have pragma(framework), you'll need to supply the 
 -L-framework -LAppKit options to dmd to link it.

 And a few things:

  1. *Please use spaces instead of tabs.*

What, so that he can force his indentation size on everyone else that works 
on the code? Or so that using the left/right arrow keys within the 
indentation zone requires an unnessesaraly large number of keypresses?

And frankly, I this strategy renders all the pro-space and pro-tab arguments 
obsolete, and it's still based on tabs anyway:

http://nickgravgaard.com/elastictabstops/

Spaces for indentation are just the worst of all worlds. And it's a total 
abuse of what space is even for in the first place.




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

2011-04-10 Thread Daniel Gibson
Am 11.04.2011 07:00, schrieb Nick Sabalausky:
 KennyTM~ kenn...@gmail.com wrote in message 
 news:int88l$uaf$1...@digitalmars.com...
 On Apr 9, 11 04:26, Adam D. Ruppe wrote:
 We discussed this first in the GUI library thread, but since it
 meandered so much, I decided to split off into a new subject. Much
 of what I say here will be old to anyone who saw the previous thread.
 There's some new stuff nearer to the bottom though.

 I, with input from others, have started writing a little module
 for simple uses of a display. You can write to a bitmap, display it
 to a window, and handle events all in an easy way. The basics are
 cross platform, but you can use native function calls too.

 http://arsdnet.net/dcode/simpledisplay.d

 It's still very much in progress, but I think it's now at the point
 where the direction I'm taking it is clear.

 [snip]

 Thanks for the great work!

 Taking the version on that link, I have ported it to use the native 
 Cocoa/Core Graphics in OS X, instead of X11. You can check out the diff in 
 https://github.com/kennytm/simpledisplay.d/commit/a790.

 Only Snow Leopard (10.6) is supported.

 I have only tested that it works on the pendulum example and the HSL 
 picker, so things like drawText and drawPixel may not work properly yet. 
 The implementation part is quite messy right now due to Objective-C.

 Since dmd does not have pragma(framework), you'll need to supply the 
 -L-framework -LAppKit options to dmd to link it.

 And a few things:

  1. *Please use spaces instead of tabs.*
 
 What, so that he can force his indentation size on everyone else that works 
 on the code? Or so that using the left/right arrow keys within the 
 indentation zone requires an unnessesaraly large number of keypresses?
 

Yeah.
Indent with tabs, align with spaces.

I find reading code with two or eight spaces for indentation hard to
read. However both styles are widely used.. if everybody just indented
with tabs and configured his editor to display 2/4/8/42 spaces for a tab
everybody could be happy.

 And frankly, I this strategy renders all the pro-space and pro-tab arguments 
 obsolete, and it's still based on tabs anyway:
 
 http://nickgravgaard.com/elastictabstops/
 

Hmm looks neat, but I'm not sure I really need that.

 Spaces for indentation are just the worst of all worlds. And it's a total 
 abuse of what space is even for in the first place.
 

The only thing that is more horrible than indentation with spaces is
mixing indentation with spaces and tabs so it's completely broken when
your editor uses another tab-width than the authors editor.

Cheers,
- Danie


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

2011-04-10 Thread bearophile
Nick Sabalausky:

 What, so that he can force his indentation size on everyone else that works 
 on the code? Or so that using the left/right arrow keys within the 
 indentation zone requires an unnessesaraly large number of keypresses?

It's a module theoretically meant for Phobos, and the Phobos coding standard 
are spaces.

Bye,
bearophile


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

2011-04-10 Thread Jonathan M Davis
 Nick Sabalausky:
  What, so that he can force his indentation size on everyone else that
  works on the code? Or so that using the left/right arrow keys within the
  indentation zone requires an unnessesaraly large number of keypresses?
 
 It's a module theoretically meant for Phobos, and the Phobos coding
 standard are spaces.

Yes. Phobos follows the convention of indenting with spaces and that levels of 
indentation are 4 spaces. So, anything which goes into Phobos needs to follow 
this convention.

the only way that tabs work is if you use them consistently, which in my 
experience almost never happens. And pretty much everywhere that I've worked 
has required that spaces be used and no tabs. When people _have_ used tabs, 
it's been a mess. Personally, I'm completely against using tabs in source 
code.

Regardless, Phobos doesn't use tabs. So, whatever someone may prefer in their 
own code, code that they intend to get into Phobos shouldn't use tabs.

- Jonathan M Davis