[#955] Ruby 1.4.3 — Yukihiro Matsumoto <matz@...>
Ruby 1.4.3 is out, check out:
1 message
1999/12/07
[#961] Ruby compileable by C++ compiler? — Clemens Hintze <c.hintze@...>
Hi,
8 messages
1999/12/10
[#962] Re: Ruby compileable by C++ compiler?
— matz@... (Yukihiro Matsumoto)
1999/12/10
Hi,
[#963] Re: Ruby compileable by C++ compiler?
— Clemens Hintze <clemens.hintze@...>
1999/12/10
Wei,
[#964] Bastion or SecurityManager for Ruby? — Clemens Hintze <clemens.hintze@...>
Hi,
15 messages
1999/12/10
[#966] Re: Bastion or SecurityManager for Ruby?
— nakajima kengo<ringo@...>
1999/12/10
Hello Clemens,
[#967] Re: Bastion or SecurityManager for Ruby?
— matz@... (Yukihiro Matsumoto)
1999/12/10
Hi,
[#989] a question about to_i — Friedrich Dominicus <Friedrich.Dominicus@...>
Sorry, I'm quite new to ruby. But I encounterd the following problem. If
17 messages
1999/12/19
[ruby-talk:01013] Re: Reparenting a block
From:
matz@... (Yukihiro Matsumoto)
Date:
1999-12-31 08:09:25 UTC
List:
ruby-talk #1013
In message "[ruby-talk:01009] Reparenting a block"
on 99/12/31, Dave Thomas <Dave@thomases.com> writes:
|Another block question. Is there any way to re-parent a Proc?
An Block has the bindings at the point where it appear, including
self, local variables, constant bindings, etc. You can alternate self
in the block bindings by using instance_eval(), as Masaki stated in
[ruby-talk:01010]. Other than self, you can alter constant binding by
using class_eval()/module_eval().
def foo(&block)
Math.module_eval(&block)
end
foo {print PI} # 3.141592654
print PI # NameError!
self and constant bindings are only modifiable bindings in the block.
You cannot alter other bindings.
Ruby/Tk is using this technics.
TkButton::new(parent) {
label "hello world"
command { exit }
}
invokes methods of a newly created TkButton object. But it may be the
cause of confusion, e.g.
Dave::new {
@answer = 42 # modify Dave's instance variable.
}
print @answer # @answer is not set here.
Hope this helps you in new millennium. :-)
Happy new year.
matz.