From: Mark Hahn Date: 2001-10-21T04:00:00+09:00 Subject: [ruby-talk:22850] Re: brace block oddity(?), curiousity Yes, x.each with do |i| ... end does look awful. That is why I suggest the with keyword be optional. So x.each do |i| ... end would also work. This is actually the opposite of the "then" keyword. "then" is only used in the one-line case and "with" would only be used in the multiline case. The use of "with" as the keyword is arbitrary. One might be able to come up with a better choice. The reason I think the keyword is better than the slash is that the slash has no symantic meaning and it sticks out like a sore thumb. I just realized this is hopeless, because if you want to fix this, then the next step would be to fix: while x y end For that matter, using do/end matches the "while" type constructs and "end" is more consistent (as the book suggests): x.each do |i| y end So I retract my suggestion. -----Original Message----- From: David Alan Black [mailto:dblack@candle.superlink.net] Sent: Saturday, October 20, 2001 11:43 AM To: ruby-talk ML Subject: [ruby-talk:22848] Re: brace block oddity(?), curiousity Hello -- On Sun, 21 Oct 2001, Mark Hahn wrote: > > It bothers me also. How about this for a solution: > > x.each with {|i| doit} > > x.each with > { > |i| > doit > } > > The "with" keyword could be optional, just like the "then" keyword. I'd rather see backslashes :-) Besides, x.each with do |i| ... end looks pretty awful. It's hard for me to say beyond that because I think having the method name and the block params on the same line looks better and is clearer. Also, it looks weird to me to have anything between a method name and a block (except for arguments to the method). David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav