Devin Mullins wrote:
> -1 +1
> -d = D.new { return 'Y' }
> +d = D.new { 'Y' }
>
> IIRC, PickAxe has a decent section on the difference between Proc.new,
> lambda, and blocks, specifically pertaining to 'return'.

Yea, I need to read that over. I'm starting to get a better picture...

I'm trying to create an abstract Funtion class that can sort-of
delegate itself as a block, lambda, Proc or method. So one of of things
involved is setting a flag to tell it whether to return locally or not.
So for example instead of my original two methods:

    def lambda_return
      lambda { return 'Y' }.call ; 'N'
    end

    def proc_return
      Proc.new { return 'Y' }.call ; 'N'
    end

I'd put:

    def lambda_return
      Function.new { return 'Y' }.local.call ; 'N'
    end

    def proc_return
      Function.new { return 'Y' }.nonlocal.call ; 'N'
    end

again expecting

  'N'
  'Y'

I _may_ have worked it out. But I'm not for sure. I need to run it
through some paces.

T.