[ruby-talk:00324] Re: binding

From: matz@... (Yukihiro Matsumoto)
Date: 1999-05-18 06:47:43 UTC
List: ruby-talk #324
Hi.

In message "[ruby-talk:00323] binding"
    on 99/05/18, Pros Yeboah <yeboah@tu-harburg.de> writes:

|Can someone please explain to me  the meaning  and usage of
|1)the  built-in method binding.

binging contains the local variable closure.  You can supply it as
the second argument of eval().

  def foo
    a = 25
    b = 55
    return binding
  end

  bind = foo            # returns foo's binding
  p eval("[a,b]", bind) # evaluate as if within foo

|2)the Kernel method  callcc.

It's a continuation.  If you know scheme's call/cc, that's it.  If you
don't know... hmm.. Could somebody explain it please?  Shugo?

                                                matz.

In This Thread