From: dblack@... Date: 2007-01-10T09:44:23+09:00 Subject: Re: [ANN] Elements of Ruby Style Hi -- On Wed, 10 Jan 2007, Daniel Finnie wrote: > dblack@wobblini.net wrote: >> I'm not sure how Daniel's example relates to the yield/call matter. > > It's kind of a null issue now, IMO, now that the method of passing blocks is > cleared up, but this is what I meant: > > $_ = "hello" > scan(/l/) > This example has a receiver that is not explicit (not in the sense that the > receiver is self but that it is not on that line). This method is falling > out of favor for the above reason. > > def meth > yield > end > This example also has a yield with no explicit receiver as defined above. If > the above example is going out of favor, why is this one the preferred > method? yield is a keyword, though, not a method, so they're not exactly commensurate. But in any case, it's not that receiverless method calls are out of favor, but more the implicit use of $_ as a receiver. It's actually something I've seen so little of, and so little discussion of, that I'm not sure what people's current thinking is on it. But it's not connected to yield, which doesn't have a receiver at all, nor to the general practice of leaving off receivers where possible. David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)