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

Daniel Gibson metalcaedes at gmail.com
Sun Apr 10 22:23:38 PDT 2011


Am 11.04.2011 07:00, schrieb Nick Sabalausky:
> "KennyTM~" <kennytm at gmail.com> wrote in message 
> news:int88l$uaf$1 at 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


More information about the Digitalmars-d mailing list