Project

General

Profile

Backport #2161

Kernel.eval ignores binding in 1.9

Added by awieland (Aaron Wieland) almost 11 years ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:25866]

Description

=begin
Kernel.eval no longer evaluates its string in the context of the binding passed to it.

In an irb session in 1.8.6:

irb(main):001:0> eval 'self'
=> main
irb(main):002:0> obj = Object.new
=> #Object:0x12aaf20
irb(main):003:0> eval 'self', obj.send(:binding)
=> #Object:0x12aaf20

In 1.9.1 (also tested in the latest nightly build for 1.9.2):

irb(main):001:0> obj = Object.new
=> #Object:0x5210f8
irb(main):002:0> eval 'self', obj.send(:binding)
=> main

I can't help but feel I'm missing something, because a bug of this magnitude should have been identified and fixed by now (it breaks a lot of code that uses ERb).
=end

Also available in: Atom PDF