Frederick Cheung wrote: > {} binds more tightly than do..end - in some cases this can lead to > your block being passed to the 'wrong' method:
Interesting, makes sense. Personally, that's one reason I don't like making method calls without parens, or doing anything else that relies on non-obvious order-of-evaluation-binding just to save a couple of parens. foo( bar {} ) or foo( bar do end ) will both do the same thing. Although the latter is kind of weird style, if I need a multi-line block for bar, I'd personally just use a temporary var instead. result = bar do end foo(result) But everyone's got their own style, I guess. Of course you COULD use {||} with multi-lines too, but it would also be stylistically weird in my opinion in that case. foo bar {|a| stuff more stuff } That's just weird. And if I DID it, I'd still want to put parens in around foo's argument, which would make it even weirder looking. Jonathan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---