Tabs vs Spaces. Article about symbols that are used for indentation in 3.8 million Perl files on CPAN
There are 135 thousand releases on CPAN now. In those releases there are about 3.8 million files with extensions .pm, .pl, .t or .pod.
Here is a link with a small research what symbols are used for indentation in all that files.
There is obvious trend, but unfortunately in this article there is no exact answer why it happen.
https://squareperl.com/en/tabs-vs-spaces-in-millions-of-perl-files
One explanation for mixed spaces and tabs is laziness, though in the common sense not the Larry Wall sense.
By default,
vi
and friends indent 4 spaces per level. But they render a tab as 8 spaces. So one level of indentation is four spaces, two are a tab, three are a tab followed by four spaces, and so on.My suspicion is that a large number of the "both" files fit this pattern.
I'm not too very surprised that the mixed spaces & tabs are the most popular choise. But I'm very surprised that the share of mixed tabs spaces is constantly decreasing. I would like to know why is that.
There are several issues that are not being considered. First off, the code for analysis looks at every line. It should ignore all blank lines, lines that are within POD (
/^=\w+/ .. /^=cut\s*$/
), all lines that are solely comments (/^\s*#/
), anything after__DATA__
or__END__
, and, if possible, anything inside a string ("..."
,'...'
,<<END_STRING
,qq
,q
, ...).The analysis code should also count the lines that start with any of the following conditions:
/^\S+/
/^\t+\S+
/^[ ]+\S+/
)/^\t+[ ]+\S+/
)/^[ \t]*[ ]+\t+\S+/
)IMHO the bloger would of better off spending his time doing a few pull requests and fixing some bugs then spending a bunch of time exaiming the ages old 'tab' vs 'space' debate.
Since the days PC computers got more than 640K of disk space on a floppy it has stopped to be an issue.
In the good old days of 64k many of old farts would argue for 'tabs' as the took only 8 bits of less memory than while '4 spaces' took up 32.
In the big scope of things it really doesn't matter much