Dave Thomas wrote: >There's another style I;ve seen her which I'm still thinking >about. Some folks put the block parameters on their own line: > > a.doit { > | name, address | > # ... > } > >It certainly looks nice, but I can't quite convince myself there's a >reason to do it ;-) And there's your reason. "Looks nice" is a good thing. Mathieu Bouchard wrote: >Here's a reason not to do it. the | name, address | construct is not an >expression. The above code puts it in the spot normally reserved to >expressions, but it is really part of the open-brace. so it should be >like: > >a.doit {|name,address| > #... >} > >The lack of spaces emphasises that those elements are all part of the same >chunk as the open brace. Adding spaces doesn't really make it any clearer, >just spacier. If we could have arbitrary subexpressions in there, it would >be a different situation and the opposition space-nonspace could parallel >the opposition outer-inner. > >But then, some people don't use spaces and indentation to carry hints as >much as they use it to space out things. The language may think it's part of the open brace, but to me, it's just the first part of the block as a whole. I use whitespace to make code easier to read, and I just find that putting the | var | on its own line: a) reduces clutter on the do line which is often long already, and b) puts it in a consistent place where I can always find it easily. --- Back to the { } vs. do/end question: Although I've considered using { } for single-line blocks, I've decided that { } in Ruby is reserved for hashes. I think I'll use do/end for all blocks, to avoid that ambiguity. Kevin