On Thu, 7 Oct 2004 07:39:04 +0900, Markus <markus / reality.com> wrote:
> On Wed, 2004-10-06 at 15:19, Joachim Wuttke wrote:
> > Thank you, Brian.
> > This is quite a convincing example: I count not less than eight
> > places where the "end" could be missing.
> > Just for curiosity: why didn't Ruby borrow indentation semantics
> > from Python ?
> 
>      Now there's an RCR I'd support.  Heck, I'd even volunteer to code
> it!

That's been hashed and rehashed here before... :) I'm guessing it's
unlikely. However, just because whitespace (except newlines) is not
syntactically relevant as far as ruby is concerned, doesn't mean it's
not syntactically relevant as far as the programmers are concerned.

What if we had a new warning level that checked for proper indentation
levels? By default, it could check any common indentation methods, so
one could use tabs, two, three four spaces, whatever; a strict mode
might check for standard library compatible code formatting.

So you might get this kind of warning:

------ script.rb ------

#!usr/local/bin/ruby -W3

class Foo
  def initialize
    puts "Hello World"
end

class Bar
  def initialize
    puts "Hello Bar"
  end
end

% ./script.rb
script.rb:6: warning: inconsistent indentation level. 
script.rb:13: parse error

This should make it easy to find such errors.

cheers,
Mark