[Israel.pm] Tabs vs. Spaces

Yuval Yaari yuval at windax.com
Tue Jun 15 08:01:24 PDT 2004


On Tue, 2004-06-15 at 17:38, Mikhael Goikhman wrote:
> On 12 Jun 2004 20:55:41 +0300, Yuval Yaari wrote:
> > 
> > [That is, lines indented by tabs only].
> > It's readable, basically, but it's not as convinient as if things are
> > aligned.
> 
> I guess we will not be able to agree on alignment. Personally I think
> the code aligned to parentheses is strewn and thus ugly estetically.
> And you basically need to reindent such code every time you rename some
> variable/function or add some more code before the parentheses. I like
> unbeatable simplicity and structure of the code indented by tabs only.

Or make your editor re-indent.
But yes, if you're using an editor that doesn't support this feature.

> 
> Anyway, like I said, there is the second policy that is still tab size
> independent, but allows an optional alignment you like, using spaces.
> 
> > Generally, if your company style mentions a tab-size (and it would)
> 
> Do you have a reason to believe it would? This is not my experience.
> Mandating the tab-size independent style seems more probable.

They should ask you to make your code look excellent on a specific
tab-size.
Using it is up to you.
At least I know a few people who are asked to use specific tab-sizes.

> 
> Please also note, in all policies except for the third one, tabs are
> forbidden in the middle of lines. Use spaces if you absolutelly need to
> align something in two lines of the same level. No tabs in the middle.
> 

I didn't notice this...
Still it is possible to make it look bad...

> > Ok, just FYI - CPerl mode can use the indention styles that I hate and it
> > looks good in any editors with any tab size.
> > Yes, I checked. I tested on a few editors with different tab sizes.
> 
> Do you mean, you may take any complex code, select it and a magical key
> will make it fully compatible with the first policy (and then the second
> policy), including the no-tabs in the middle rule? Please send me the
> config then, I will include it in the documentation of my projects. :)

Again, I forgot about the spaces in the middle instead of tabs.
I see no point in that.

Why? Here:

foreach (1..100) { # comment
    print "\n";    # new comment
}

That's \t before "print".
If your tab-width is 4, you'll need 4 spaces before "# new comment"
If your tab-width is 8, you'll need no spaces (which would make it look
ugly anyway).


  --Yuval




More information about the Perl mailing list