On Fri, Jun 13, 2003 at 09:01:59PM +0900, Chris Pine wrote: > ----- Original Message ----- > From: "Mauricio FernáÏdez" <batsman.geo / yahoo.com> > > > My bet is that he means > my_func bar, baz { ... block ... } > as opposed to > block = proc { ... block .., } > ---------------------------- > > > But since `proc' is just a method which takes a block... aren't these > practically identical syntax? As I see it, there's really only one way to > make a block. You chose the wrong line :-) 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 -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com * JHM wonders what Joey did to earn "I'd just like to say, for the record, that Joey rules." -- Seen on #Debian