Yukihiro Matsumoto wrote:
>
> TWO differences.
>
>   * Methods and Lambdas require specific arguments; Blocks do not.
>
>   * return in Lambdas terminate the lambda execution; return in
>
>     Blocks terminate surrounding method, or error if there isn't
>     surrounding method anymore.
>
> But I'm not yet sure if I will introduce separated new class: Lambda.

Thanks, matz. Those are the well spelled out points I've been seeking.

On the first account, I was thinking that blocks too were going to
become restricted. My mistake. Is it not enough to be able to use
*parameter? i.e. each {|*a| ... } Are there particular use cases that
make loose arguments for block neccessary? I used to like the idea,
even for methods, but I've since thought better of it.

The second is a more interesting difference. One that I've heard before
but forget about. It makes sense mentally too, but I actually don't see
how it happens.

  def blk
    yield ; "BLOCK"
  end

  def lam(&lamb)
    lamb.call ; "LAMBDA"
  end

  @@l = lambda { return "L" }
  p lam &@@l  #=> "LAMBDA"

  @@b = lambda { return "B" }
  p blk &@@b  #=> LocalJumpError

  p lam { return "L" }  #=> LocalJumpError

  p blk { return "B" }  #=> LocalJumpError

That's confusing.

Irregardless, I do think these two points are sufficiant to make blocks
and lambdas different objects. One object can have more than one
_behavior_ depending on its usage/context. Both of your points are
about behavior differences rather then substance differences. I think
saying they are two diffent things is more confusing than saying they
are one with two different uses.

Thanks,
T.