Mauricio FernáÏdez <batsman.geo / yahoo.com> wrote in message > The point was that the "normal way" (with lambdas but not blocks la > Ruby) would be > my_func(bar, baz, block) > ie. passing the lambda explicitly and having to use block.call inside > my_func, instead of having yield call the "implicit block". > > As for the creation of the block, that's by far the most common (and > sensible) way, but what about (silly example) > > irb(main):003:0> class A > irb(main):004:1> def foo(bar) > irb(main):005:2> puts "A#foo #{bar}" > irb(main):006:2> end > irb(main):007:1> end > => nil > irb(main):008:0> block = A.instance_method(:foo).bind(A.new) > => #<Method: A#foo> > irb(main):009:0> 2.times &block > (irb):9: warning: `&' interpreted as argument prefix > A#foo 0 > A#foo 1 > => 2 > irb(main):010:0> block = A.new.method(:foo).to_proc > => #<Proc:0x40189040@(irb):10> > irb(main):011:0> 2.times &block > (irb):11: warning: `&' interpreted as argument prefix > A#foo 0 > A#foo 1 > => 2 Exactly what my question was intended to ask. So, it's been an interesting discussion around blocks and yield, but any answer(s) to the question: What is the reason for the implicit block syntax? And, along the way, any answers to my question (on a separate thread) about why def ... end returns nil, instead of some kind of method object; and class ... end returns the last expression, also instead of some kind of class instance. Thanks.