From: Jeremy McAnally Date: 2008-10-09T00:39:51+09:00 Subject: Re: Why not adopt "Python Style" indentation for Ruby? Then you're introducing a big chunk of parser ambiguity. For example if a == b then puts "hello"; puts "world" # end implied Do you mean if a==b puts "hello" *AND* puts "world" or should you output "hello" if it's true and "world" no matter what. That would put a big load on the parser to figure out the different between the different line delimiters and how that impacts the code around it. --Jeremy On Tue, Oct 7, 2008 at 2:35 PM, Brian Candler wrote: > Yukihiro Matsumoto wrote: >> But I sometime want "end"-less single line structure (in normal >> order), e.g. >> >> if foo then bar # pseudo syntax; you may require delimiters >> >> not >> >> bar if foo >> >> especially when I write very small code chunk. Not knowing what >> syntax it should be. > > As an observation, I always found ruby's "then" to be a rather > superfluous non-keyword; that is, > > if a == b then > ... > end > > if a == b > ... same > end > > if a == b then ...; end > > if a == b; ... same; end > > So a possible (but highly incompatible) approach would be for "then" to > introduce a single-line block, e.g. > > if a == b then puts "hello"; puts "world" # end implied > > if a == b > puts "hello" > puts "world" > end > > It could also be used, although less obviously, in other constructs: > > while !a.empty? then puts a.shift > > I'm not sure what 'then' followed immediately by newline should do. > > Anyway, this is just an idle thought, as it would break lots of things. > -- > Posted via http://www.ruby-forum.com/. > > -- http://jeremymcanally.com/ http://entp.com/ http://omgbloglol.com My books: http://manning.com/mcanally/ http://humblelittlerubybook.com/ (FREE!)