Yukihiro Matsumoto wrote:
> Hi,
> 
> In message "Re: block_given? vs defined? yield"
>     on Thu, 9 Feb 2006 01:42:30 +0900, Daniel Berger <Daniel.Berger / qwest.com> writes:
> 
> |Is there any difference between "block_given?" vs "defined? yield" ?
> 
> They are almost same.  The only difference is the former is a method,
> and the latter is a syntax (no call), and consequently the latter
> might be a little bit faster, but practically you can consider them
> same.
> 
> 							matz.

I didn't know block_given? was a method. So there's another possible
difference besides speed:

irb(main):001:0> class X
irb(main):002:1>   def block_given?; false; end
irb(main):003:1>   def foo; yield if block_given?; end
irb(main):004:1>   end
=> nil
irb(main):005:0> X.new.foo {puts "FOO"}
=> nil

Just a bizarre thought.

-- 
      vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407