[ruby-talk:00904] Re: Contrast Ruby and Other Languages

From: Clemens Hintze <clemens.hintze@...>
Date: 1999-11-03 15:12:36 UTC
List: ruby-talk #904
Huayin Wang writes:
> > 
> >   block_given?
> >   with_block?
> >   has_block?
> >   have_block?
> 
> how about "accept_block?".

See following code, please ...

def myloop
   if accept_block?
      while true
         yield
      end
   else
      raise SyntaxError, "no block given"
   end
end

If I look that code, I have the feeling, that myloop *asks* somehow or
somewhere, if it is permitted to accept a block! That clearly was not
the intention I had writing that method.

Huozhe, ni xiang zenmeyang? :-)

\cle

In This Thread

Prev Next