August 15, 2006
On Mon, 14 Aug 2006 18:23:27 -0700, Sean Kelly <sean@f4.ca> wrote:
> Regan Heath wrote:
>>  Oh, and for those who want to align text on seperate lines remember the golden rule; "hard tabs first, spaces following" and you'll have no problems. Regardless of the viewers tab width the lines will align. (ignoring non fixed-width fonts, for which no solution involving spaces/tabs will work).
>
> What about:
>
>      int x,
>          y,
>          z;
>
>      if( x == y ||
>          y == z )
>      {
>          func( x,
>                y,
>                z );
>      }

No problem. The above is formatted like so:

<t>int<s>x,<cr>
<t><s><s><s><s>y,<cr>
<t><s><s><s><s>z;<cr>
<cr>
<t>if(<s>x<s>==<s>y<s>||<cr>
<t><s><s><s><s>y<s>==<s>z<s>)
..etc..

you get the idea. where: <t> = tab, <s> = space

The rule "hard tabs first, spaces following" implies you cannot mix tabs and spaces, meaning, your line starts with tabs (denoting the left hand margin) then has characters or spaces but never another tab, therefore <t><s><t> or <s><t><s> is illegal.

In short, use tabs to indent the left hand margin only, and spaces for everything else.

> Changing tab widths can totally mess up this sort of thing if tabs were involved in the creation of any of the involved lines. Things get even worse if some lines were indented with spaces and others with tabs. I'll admit that none if this is a problem for solo projects, but in a group it can be a disaster.  And maybe you can enforce indenting rules to this level of detail, but I can't :-)

I'll agree, trying to get a bunch of people to actually use the same formatting, or even to format their code consistently is nearly impossible..  in my ideal world I would have an editor which auto-formatted code that I was reading (regardless of the on-disk, in-file, actual format..) now that would be nice.

Regan
August 15, 2006
On Tue, 15 Aug 2006 00:06:37 -0700, kris wrote:


> Be a real programmer! Be a real man! Let's drop all that nonsense and vote for RFC '451'; save the wrists and minds of millions of real, live Americans!

This is why I thank Bob I'm an Aussie. ;-)

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
15/08/2006 5:32:58 PM
August 15, 2006
Anders F Björklund wrote:

> Dawid Ciężarkiewicz wrote:
> 
>> My thoughts are always like this: why creators of C language allowed people to format code freely? Wouldn't world be a better place if languages would enforce their one-true-coding-style? If there would be no choice there would be no reason to argue.
> 
> Because There Is More Than One Way To Do It (TIMTOWTDI) ?
> 
> I had my hard tabs at 4, because of my Macintosh upbringing, but in UNIX they have always been at 8 (so now I use spaces)
> 
>> [...]
>>
>> What do you think?
> 
> I like choice.

You'd always had a choice of using (or not) language that enforces some
coding style.

> PS.
> I don't understand the "it would better if we only had one D compiler"
> or "it would be better if we only had one official GUI library" either.

Neither I do.
August 15, 2006
kris wrote:
> 
> D RFC 451: A Proposal To Save American Wrists and Minds
> -------------------------------------------------------
> 
> It has recently been shown that extensive use of the space-character encourages spatial disorientation, conceptual difficulties, left-brain degradation, a general loss of well-being, and the historic "Repetitive Repetitive" syndrome. The tab-key was invented as a measure of concern for these conditions.
> 
> In order to enhance the longevity of one's wrists, sanity, and associated livelihood, we propose the same principal be applied to identifiers within the D language. For example, how many programs have more than 999 functions? For those that don't, it would surely be far simpler to identify functions with up to three digits instead of those silly long-winded names? Factorial, for instance: it should be called "173" instead, or "387". Far shorter and much easier to type!
> 
> Because of this, we submit that D should allow identifiers to begin with a numeric character. Numeric literals, since they are relatively seldom used, should be prefixed to isolate then.
> 
> Since all identifiers can use short groups of digits instead of those ridiculous long names, we can reserve the common 26 letters of the alphabet for special language idioms: the 'newline' keyword (above) should be shortened to a simple 'n', since we'll all know what that stands for; 'indent' should become 'i' also, to simplify things in the same manner. The letter 'l' should be used to prefix literals.
> 
> 
> u__173(u__0){__n__i()f(0__<=__l1){n__i(2)__r__1__n;i}n__i()e{n__i(2)r__0__*__173(0-l1)__n;i}n__}n; 
> 
> 
> 
> Ahh ... isn't that so much more appropriate? Those left-wing lunatics with their extensive use of whitespace and so-called 'meaningful' identifier-names ... they're just so full of it.
> 
> Be a real programmer! Be a real man! Let's drop all that nonsense and vote for RFC '451'; save the wrists and minds of millions of real, live Americans!
> 
> Vote '451' today!

ROFL.

Congrats.  I think you just posted the best example of "death by specification" anyone could have conjured.  As you know, we need that kind of humor* around here (at work I mean).

(* or "humour", if you're into that sort of thing)

-- 
- EricAnderton at yahoo
August 15, 2006
Dawid Ciężarkiewicz wrote:

>>I like choice.
> 
> You'd always had a choice of using (or not) language that enforces some
> coding style.

Right, which is why I don't use Python if I can somehow avoid it...

--anders
August 15, 2006
Regan Heath wrote:
> On Mon, 14 Aug 2006 18:23:27 -0700, Sean Kelly <sean@f4.ca> wrote:
>> Regan Heath wrote:
>>>  Oh, and for those who want to align text on seperate lines remember the golden rule; "hard tabs first, spaces following" and you'll have no problems. Regardless of the viewers tab width the lines will align. (ignoring non fixed-width fonts, for which no solution involving spaces/tabs will work).
>>
>> What about:
>>
>>      int x,
>>          y,
>>          z;
>>
>>      if( x == y ||
>>          y == z )
>>      {
>>          func( x,
>>                y,
>>                z );
>>      }
> 
> No problem. The above is formatted like so:
> 
> <t>int<s>x,<cr>
> <t><s><s><s><s>y,<cr>
> <t><s><s><s><s>z;<cr>
> <cr>
> <t>if(<s>x<s>==<s>y<s>||<cr>
> <t><s><s><s><s>y<s>==<s>z<s>)
> ..etc..
> 
> you get the idea. where: <t> = tab, <s> = space
> 
> The rule "hard tabs first, spaces following" implies you cannot mix tabs and spaces, meaning, your line starts with tabs (denoting the left hand margin) then has characters or spaces but never another tab, therefore <t><s><t> or <s><t><s> is illegal.

Oh I see, you place the restriction at the column level.  That would work, though it would mean holding down my spacebar a lot :-)

> I'll agree, trying to get a bunch of people to actually use the same formatting, or even to format their code consistently is nearly impossible..  in my ideal world I would have an editor which auto-formatted code that I was reading (regardless of the on-disk, in-file, actual format..) now that would be nice.

I bet emacs could be made to do this with some work, though it would save files in the same formatting.


Sean
1 2 3 4 5 6
Next ›   Last »