Project

General

Profile

Actions

Backport #2161

closed

Kernel.eval ignores binding in 1.9

Added by awieland (Aaron Wieland) over 14 years ago. Updated almost 5 years ago.

Status:
Closed
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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0