April 12, 2011
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

April 12, 2011
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
April 12, 2011
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.
April 12, 2011
Jérôme M. Berger wrote:
> Nick Sabalausky wrote:
>> "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.3396.1302548836.4748.digitalmars-d@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:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



April 12, 2011
Nick Sabalausky wrote:
> "teo" <teo.ubuntu@yahoo.com> wrote in message news:io00gq$5rc$1@digitalmars.com...
>> On Fri, 08 Apr 2011 20:26:07 +0000, 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
>>>
>> I admit I didn't read the whole thread...
>>
>> I just wanted to point out the following:
>> - XCB (http://xcb.freedesktop.org/) - aims to replace Xlib
>> - Wayland (http://wayland.freedesktop.org/) - aims to replace the X server
>>
>> A quick look at the source code shows that you are targeting the X server, which might not be the best idea.
>>
>> Please ignore my post, if the above is well known and has already been discussed.
> 
> Even the Wayland site says that it's not going to replace X server anytime soon and that they're going to co-exist for the forseeable future. Don't know anything about XCB though.
> 
	AFAIK, Xlib has already been rewritten on top of XCB, but most
"big" GUI toolkits (Gtk, Qt, ...) are staying on Xlib (some of them
did take a stab at XCB and dropped it as not worth the trouble).

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



April 12, 2011
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:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



April 12, 2011
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:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr



April 12, 2011
"Cliff Hudson" <cliff.s.hudson@gmail.com> wrote in message news:mailman.3414.1302586393.4748.digitalmars-d@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! ;)


April 12, 2011
""Jérôme M. Berger"" <jeberger@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 :(


April 12, 2011
""Jérôme M. Berger"" <jeberger@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.