(2012/11/08 5:48), matz (Yukihiro Matsumoto) wrote:
> Under the current language spec, absence of '& argument' may or may not mean the method would take a block.

I agree that such checking is very useful.

  # example code
  p 'str'.gsub('x') do

  end


One idea:

If compiled method does not contain
 - `yield' statement
 - super statement
 - block argument
then the method is marked as "block is not needed" method.

This approach introduce incompatibility because we can call block in `eval'.

  # example
  def foo str
    eval str
  end

  foo('yield') do
    ...
  end

And maybe there are other issues.

-- 
// SASADA Koichi at atdot dot net