From: Brian Candler Date: 2008-10-07T04:57:45+09:00 Subject: Re: Why not adopt "Python Style" indentation for Ruby? Just my quick chip-in: I find Ruby's syntax as-is works remarkably well. The only problem it causes me is with do-end mismatches where the parser just runs off the end of the file, with no indication of where the missing do or end might be. I have on many occasions resorted to chopping a copy of my source file to find the problem (that is, lopping out a class or a method at a time until the problem goes away) DSL's are also a source of this problem: context "an empty object" do should "have zero size" do ... end end Miss out either of those 'do's and it's hard to tell where the problem is. Personally, the solution I would love to have is a parser/pretty-printer tool which can read a Ruby source file and spit it back out with "standardised" indentation. It would then be obvious where the problem lies. You'd get the benefit of python-style indentation, without actually having to use python-style indentation :-) Unfortunately, the lack of specification makes it really hard to implement; and I don't think I could use something like ParseTree as I think it would rely on the file being parsed successfully up-front, whereas I want this for programs which don't parse. Maybe there's another ruby implementation which could do this. Otherwise, the best I can think of is to modify the existing Ruby parser to spit out auto-indented code as it reads the source. I don't wish to change to a different text editor, and in any case, I don't believe that *any* editor has a sufficiently complete knowledge of Ruby lexing and parsing rules that it will always match the Ruby way of parsing source. Anyway, if anyone knows of a tool which does this, it would make me very happy :-) -- Posted via http://www.ruby-forum.com/.