Hi,

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?

Here is an example:

class Foo
    def set_value(v)
	@value = v
    end
    
    def value=(v)
	@value = v
    end
    
    def value
	@value
    end
end

bar = Foo.new
bar.instance_eval {
    set_value 1
    p value # -> 1
    p self.value # -> 1
}
bar.instance_eval {
    value = 2
    p value # -> 2
    p self.value # -> 1, should be 2?
}
bar.instance_eval {
    self.value = 3
    p value # -> 3
    p self.value # -> 3
}


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?

-- 
Mike