From: "Bilyk, Alex" Date: 2008-10-07T11:09:54+09:00 Subject: Re: Why not adopt "Python Style" indentation for Ruby? +1 I always type (), [], {}, do/end, begin/end,<>, etc. upfront together and then insert what goes in between. I can't quite remember the last time I have mismatched these in any language. OTOH, I can't stand Python's semantically significant white space approach. It seems to give me trouble a lot more often than I'd like... perhaps because I have not used it long enough. Alex -----Original Message----- From: Justin Collins [mailto:justincollins@ucla.edu] Sent: Monday, October 06, 2008 3:55 PM To: ruby-talk ML Subject: Re: Why not adopt "Python Style" indentation for Ruby? Frasier Mruby wrote: > Dear Mats, > > I am kind of new to ruby and like it after looking python first. As > some other people said, my only major complaint is it's many "END". > Among java/c/C++/python, the "END" keep reminding me the inconvenience > of it during coding ruby. I like ruby because it's easy to learn, and > to read. It's designed for be friends of programmers. But I feel the > "END" may have a negative role to ruby's purpose or attraction. > Like any new language, it takes some time to adjust your eyes and fingers. > 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. > None of your suggestions seem to address this issue. Matching 'end' is no harder than matching '}'. If you get confused, add documentation like some people do: end#if end#while end#class > I understand and agree your comment that ruby had better to have > something to close the code block. But I sincerely hope you could come > up something else to replace the "END". > > My first thought to use brace "{...}" to replace "END" since it's a > popular convention. > But then it looks like C/Java. > I suggest to use only the "do...end" to formalize the blocks, brace {} > will be stopped to be used. It seems to me it's a waste of symbols to > have two ways to represent blocks, which may not be the most frequently > used. Or consider to use use: > "/* */", "|...|", "<...>", "[...]" , "(...)", "((...))", , "//...//", " > :...: ", " '...' ", " `...` " for blocks. > > To enhance readability is probably one of ruby's design purpose and I > really hope some thing could be done earlier to make the "END" looks > prettier. > I think 'end' looks fine, personally. I used to use curly braces all the time, but now I find myself using them as little as possible. do/end seems nicer and I don't get them confused with hashes that way. Besides, I enjoy the current look for conditionals. Given your later example, I prefer to see if b is not nil def bar b than if b is not nil { def bar b { Especially if it's going to lead to arguments about where that '{' should go. Same line? Next line? Next line indented? I don't want C. I don't want Java. I don't want parentheses around my conditionals when they aren't needed. I don't want to have to use my shift key more than necessary. I really don't see the problem with the current syntax. I respect your opinion but definitely do not agree. -Justin