From: Roger Pack Date: 2009-05-22T22:55:05+09:00 Subject: Re: Pythonic indentation (or: beating a dead horse) > n = 2 * -[1,2,3,4,5].inject(0) do |a, b|: > c = a * 2 > a * c + b > result = 8 * -if n > 0: > -n += 10000 > else: > n + 500000 > puts result > > Once again, worked perfectly on its first time through the > preprocessor. It would appear that "end's" actually help with readability in a few cases :) I'm glad to see you have some code. Now put it on github, make a gem of it, and advocate it :) Here are a few other thoughts on it. (Keeping things friendly and civil...) 1) maybe it could become more of a generic preprocessor? (i.e. you give it arbitrary rules, like "see this, change it to this")? 2) maybe it could be even smarter about its extrapolation, i.e. allow 4.times {|n|: puts n [accomodate for braces--one fewer keystroke!] or even 4.times |n|: puts n [put in its own do's and end's if not there] or who even needs :'s? 4.times |n| puts n [whenever it sees an ending | without preceding do or {, count it as an indent based block] That would be interesting, and much more whitespacey, though slightly less ruby-y . To clarify Tony's point from above, you can't really do case statements using only indentation and :'s. Other constructs would work though (except for the ambiguities mentioned earlier might prevent anythin but a preprocessor being able to, for ruby's case). -=r -- Posted via http://www.ruby-forum.com/.