Follow my reasoning here.

It's not unusual to pass a block to a constructor
and do an instance_eval on this. It's rather 
convenient because it can prevent long
parameter lists, making the initialization more
explicit and so on.

But it means when I call it, I can't use local variables
from my current context. Oops! I'll use globals, then.
See below.

    class MyClass

      attr_accessor :alpha, :beta, :gamma

      def initialize(&block)
       instance_eval &block
      end

      def inspect
        "[#{@alpha} #{@beta} #{@gamma}]"
      end

    end


    $x = 5; $y = 6; $z = 7
    obj = MyClass.new { @alpha = $x; @beta = $y; @gamma = $z }

    p obj


Yet this is ugly. What I'd *like* to do is pass the locals into the block
something like this (as when starting a new thread):

    x = 5; y = 6; z = 7
    obj = MyClass.new(x,y,z) { |p,q,r| @alpha = p; @beta = q; @gamma = r }

Well, "yield" would work, except it doesn't evaluate in the context of the
instance.

Or "instance_eval" would work, except that it won't allow any parameters.

I've been messing with procs and methods and unbound methods to no
avail.

Is there currently a way to do this?

Hal


~