On Feb 8, 2006, at 12:01 PM, 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 yield could be considered "defined" or not. Does this  
mean yield is not a key word?

irb(main):014:0> def quby
irb(main):015:1>   puts hello
irb(main):016:1>
irb(main):017:1> end
=> nil
irb(main):018:0> defined? quby
=> "method"

Gasp!

irb(main):020:0> def with_ablock
irb(main):021:1>   p defined? yield
irb(main):022:1> end
=> nil
irb(main):023:0> with_ablock { 1 }
"yield"
=> nil
irb(main):024:0> with_ablock
nil
=> nil

Well that shows home much I know about the operation of defined?  
(that is to say very little.)

So is yield a method that only has scope inside the calling method? I  
tired one of these method(:yield) but it didn't work. (Nor should it,  
even if my previous statement is correct). I thought maybe defined?  
worked for keywords, but that doesn't really make sense. Or is  
defined? yield just a "hack" (I use "hack" in the nicest way  
possible.) and yield is a keyword, its just that block_given? has to  
have some way to be implemented and you didn't want to make  
block_given? a keyword (which makes sense, the fewer the keywords the  
better, IMO.)