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

Shlomi Fish shlomif at iglu.org.il
Mon Jun 1 13:51:00 PDT 2009

On Monday 01 June 2009 23:19:05 Shmuel Fomberg wrote:
> Mikhael Goikhman wrote:
> >> Shlomi Fish observed that Ruby scripts use much more indentation levels
> >
> > Let's attempt to analyze a bit.
> I want to add to Mikhael's ideas, that maybe Ruby's syntax encourage
> high indentation level. for example, as much as I understand, you can
> write something like:
> some.chained.call.each { |item|
>                           <code>
>                         };
> and if Rudy style encourage large blocks of code in this
> iterator, then the whole code will shift right significantly.

I would write it as

some.chained.call.each do |item|
[Indent]Something with item.

With one indentation level inside the loop. I never align code to the |item| 
like that. And yet, I still tend to run out of indentation.
> In Perl, it will be translated to foreach / loop block, with one
> indentation level. and most of the people does not write large code
> inside map/grep/sort code blocks.
> Shlomi, does that make sense?

Unfortunately, it does not.


	Shlomi Fish

> Shmuel.
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl

Shlomi Fish       http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/

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