Project

General

Profile

Bug #2782

Binding#eval not completely indicative of its binding

Added by trans (Thomas Sawyer) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
Backport:
[ruby-core:28307]

Description

=begin
binding.eval("FILE") does not return the file from which the binding was created.

Given the purpose of binding it should hold that:

FILE == binding.eval("FILE")
=end


Related issues

Has duplicate Ruby master - Bug #1769: eval with binding, without locationClosedActions

History

#1

Updated by zenspider (Ryan Davis) over 9 years ago

=begin

On Feb 23, 2010, at 05:18 , Thomas Sawyer wrote:

Bug #2782: Binding#eval not completely indicative of its binding
http://redmine.ruby-lang.org/issues/show/2782

Author: Thomas Sawyer
Status: Open, Priority: Normal
Category: core
ruby -v: 1.9.1

binding.eval("FILE") does not return the file from which the binding was created.

Given the purpose of binding it should hold that:

FILE == binding.eval("FILE")

Just my two cents: (yen?)

FILE is expanded at parse time directly into the parse tree. As such, it isn't really a variable or a constant, just a placeholder. I don't think it is going to be easy to make it act like a constant for Binding#eval.

=end

#2

Updated by mame (Yusuke Endoh) over 9 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

=begin
Hi,

2010/2/23 Thomas Sawyer redmine@ruby-lang.org:

binding.eval("FILE") does not return the file from which the binding was created.

Given the purpose of binding it should hold that:

FILE == binding.eval("FILE")

In the current semantics, I guess binding does not includes
the imformation of filename and lineno.

At least, this is not a bug. I moved the ticket to Feature
tracker.

--
Yusuke ENDOH mame@tsg.ne.jp
=end

#3

Updated by mame (Yusuke Endoh) over 9 years ago

  • Target version set to Next Major

=begin

=end

#4

Updated by mame (Yusuke Endoh) over 9 years ago

  • Assignee changed from matz (Yukihiro Matsumoto) to mame (Yusuke Endoh)
  • Target version changed from Next Major to 1.9.2

=begin
Hi,

2010/4/11 Yusuke Endoh redmine@ruby-lang.org:

2010/2/23 Thomas Sawyer redmine@ruby-lang.org:

binding.eval("FILE") does not return the file from which the binding was created.

Given the purpose of binding it should hold that:

FILE == binding.eval("FILE")

In the current semantics, I guess binding does not includes
the imformation of filename and lineno.

At least, this is not a bug. ?I moved the ticket to Feature
tracker.

Sorry I was wrong. I didn't know 1.8 preserves the filename.
I agree that this is a bug.

And this ticket duplicates #1769. I've suggested a patch in that ticket.

--
Yusuke Endoh mame@tsg.ne.jp
=end

#5

Updated by mame (Yusuke Endoh) over 9 years ago

  • Status changed from Open to Closed

=begin
This issue was solved with changeset r27716.
Yuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF