On Tue, Feb 06, 2007 at 08:20:49AM +0900, gwtmp01 / mac.com wrote:
> Sometimes you want a Proc to behave like the body of a method (the  
> lambda flavor of procs) and sometimes you want it to behave like the  
> body of
> an iterator (the Proc.new flavor of procs).

What are those different behaviours?
1. Handling of 'return'
2. Handling of arity
3. Anything else?

If it's just (1) and (2), then I just wonder if you could get the different
behaviours using different keywords, so that there's only a single
underlying proc-like object.

As another idea, if we really need different behaviours, it could be an
explicit attribute of the object:

    a = Proc.new(:iterator) { ... }
    b = Proc.new(:method_body) { ... }

    def proc(opt = :iterator)
      Proc.new(opt)
    end

    def lambda(opt = :method_body)
      Proc.new(opt)
    end

    # or is it the other way round??

Regards,

Brian.