From: Frasier Mruby Date: 2008-10-07T04:24:17+09:00 Subject: Re: Why not adopt "Python Style" indentation for Ruby? James, thank you for you fast response. I didn't propose to get rid of the "END" like python does, but wondered if there could be cleaner syntax to as an alternative for "END". >James Britt wrote: >> I am fine to have "END" for class or methods. But for IF,WHILE, CASE, >> FOR, etc., when there are many levels it often make me confused what the >> matching part of the those "END"s are. > > Then don't do that. Seriously. Twisty conditionals is a code smell. > (Having fought with deep hierarchies of YAML and HAML, the lack of an > explicit "end" token doesn't really help in complex documents; in fact, > it can be detriment. Sometimes explicit is better than implicit.) > Ruby code is reasonable or readable with "END". And I agree a better editor would help to find matching END, but still wonder if there could be room to make the ruby code cleaner by considering other syntax to replace "END". What I was saying in previous post is to free up the braces "{}" out of block syntax to replace "END". For blocks, besides "do...end", use something else like "[], or /**/. e.g.: class Foo def bar(b) c = b+1 if b is not nil if c > 10 c++ if c %2 == 0 c += 3 print c end end if d < 9 d += 2 print d end end a = [1, 2] a.each {|num| print num } end end # tries to clean up the "END"s class Foo def bar(b) { c = b+1 if b is not nil { if c > 10 { c++ if c %2 == 0 { c += 3 print c } } if d < 9 { d += 2 print d } } a = [1, 2] a.each [|num| print num ] a.each (|num| print num ) a.each < |num| print num > a.each /* |num| print num */ a.each /# |num| print num #/ ... } end If {} can represent a bock, then personally it might also readable to use [] and syntax above to denote blocks. I also like the idea that "END" is optional for one line if, like: if a > 0 : print a I can live with "END" in ruby, now just want to express an opinion or wish to make the ruby code more cleaner, and more programmer attracted. -- Posted via http://www.ruby-forum.com/.