[Israel.pm] Number of Indentation Levels in Ruby and Perl

Shlomi Fish shlomif at iglu.org.il
Mon Jun 1 03:23:53 PDT 2009

On Saturday 30 May 2009 22:43:26 Omer Zak wrote:
> On Sat, 2009-05-30 at 19:23 +0000, Mikhael Goikhman wrote:
> > On 30 May 2009 19:42:43 +0300, Shlomi Fish wrote:
> > > My question is: can anyone explain why are 4-ws-increments good enough
> > > in Perl, C, and other languages, but they tend to be insufficient in
> > > Ruby code?
> [... snipped ...]
> > Really, I don't see a point in your question. There are no such rules as
> > you presented. I successfully use Tabs for indentation in Perl, C, Python
> > and Ruby. You can view such code using 2, 3, 4, 5 or 10 spaces per tab.
> > And as for the compactness of the code, it highly depends on a developer.
> The question is not really about number of spaces per indentation level.
> It is about the average number of indentation levels actually used in
> code written in a specific language.

Well said, Omer. Indeed I think that Mikhael has missed the point.

> Shlomi Fish observed that Ruby scripts use much more indentation levels
> than scripts and programs written in other languages.  

Either that, or the relatively small number of indentation levels does not 
allow writing too much code in a Ruby line to accommodate for the extra 
shortness of the line.

> The question if
> and why it is so is valid and I am interested in answers to the
> question.
> Anyone who develops software in LISP or Scheme - please add input to
> comparison of indentation levels in those languages relative to the
> languages mentioned by Shlomi and Mikhael.

Back when I wrote Scheme and Lisp code, I didn't usually need too many 
indentation levels, but then again my functions tended to be short and I've 
written mostly toy and experimentation code. Often, too many indentation 
levels are indicative that one should extract a function or method from the 


	Shlomi Fish

Shlomi Fish       http://www.shlomifish.org/
Understand what Open Source is - http://xrl.us/bjn82

God gave us two eyes and ten fingers so we will type five times as much as we

More information about the Perl mailing list