----- Original Message -----
From: Mike <mike / lepton.fr>
To: ruby-talk ML <ruby-talk / ruby-lang.org>
Sent: Wednesday, May 02, 2001 7:42 AM
Subject: [ruby-talk:14544] Calling assignment methods in instance_eval

>
> When I use the instance_eval method to change the value of self in a
block, I cannot use the methods in the form 'foo='. Ruby creates a variable
foo without looking for a method with this name.
> It works fine if I add self as explicit receiver, but I don't like that.
> Is this an expected behavior?

My impression is that this is expected behavior.

Without the explicit receiver, there's no way (I think)
to distinguish these from assignment to local
variables.

> Another question:
> How could I implement a Object.self_call(*args, &block) method?
> It should call block like instance_eval (change 'self') but pass args to
the block. I don't understand well the trick in [ruby-
> talk:4888]: where are 'instance_method' and 'bind' methods documented?

Hmm, can't help you with that one offhand.


Hal