On Thu, Oct 07, 2004 at 07:19:19AM +0900, 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 ? Probably because such forced indentation is extremely annoying in practice :-) I suppose Ruby could make finding these problems much easier if there were a way of distinguishing a method end, and a class/module end, from a block end: class Foo def m1 ... enddef # ? ... endclass # ? Being forced to write that could be annoying too. But actually, just having a way to test at compile time whether you're outside a method call, or outside a class definition, would be good enough for me: class Foo def m1 "foo" end method_boundary <-- raise error if inside 'def' def m2 "bar" end method_boundary ... end class_boundary <-- raise error if inside Class or Module class Bar ... method_boundary end class_boundary Sprinkling a few "method_boundary" and "class_boundary" statements at strategic points in a file would easily localise the problems. I wonder if there is a clever way to implement this directly in Ruby? But I still think a simpler and better solution would be an auto-indenter. It has to be a fairly complete Ruby parser, but all it would output is each original input line, with preceeding white-space stripped and replaced with n*(nesting depth) spaces/tabs. In other words, I don't want it to split or join any existing lines, just re-indent the lines which are there. Regards, Brian.