LAMBEAU Bernard schrieb: > Ruby's documentation of instance_eval shows the "signature" of instance_eval as: > > obj.instance_eval {| | block } => obj > > I assume that the block should not take any argument. However, if I > write the following code: > > class A > def sayhello(who) > puts "hello #{who}: #{object_id}" > end > end > > A.new.instance_eval do |who| > sayhello("me") > who.sayhello("who") > end > > it prints "hello me: -605850598" then "hello who: -605850598" > > Is is guaranteed to work?? > > blambeau > should be, because it's documented. Not in the code-example but in the text: In order to set the context, the variable self is set to obj while the code is executing, giving the code access to obj¡Æs instance variables.