Project

General

Profile

ActionsLike0

Bug #6038

closed

#instance_eval bug

Added by ddebernardy (Denis de Bernardy) about 13 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
[ruby-core:42688]

Description

instance_eval seems to change the object_id in some cases:

begin
stack = []
do_stuff = lambda do |&chain|
puts "Actual: #{chain.object_id}"
chain.call
end

chain = lambda do
if filter = stack.shift
filter.call(&chain)
end
end

puts "Expected: #{chain.object_id}"
stack << do_stuff
chain.instance_eval { @completed = false }
chain.call
end

RUBY_VERSION
=> "1.9.3"
begin
?> stack = []
do_stuff = lambda do |&chain|
?> puts "Actual: #{chain.object_id}"
chain.call
end

?> chain = lambda do
?> if filter = stack.shift

  filter.call(&chain)
end

end

?> puts "Expected: #{chain.object_id}"

stack << do_stuff
chain.instance_eval { @completed = false }
chain.call
end
Expected: 2152379740
Actual: 2152379520

#2

Updated by ko1 (Koichi Sasada) about 13 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)
#3

Updated by shyouhei (Shyouhei Urabe) about 13 years ago

  • Status changed from Open to Assigned

Updated by nobu (Nobuyoshi Nakada) over 12 years ago

  • Category set to core
  • Assignee changed from nobu (Nobuyoshi Nakada) to matz (Yukihiro Matsumoto)
  • Target version set to 3.0

Updated by mame (Yusuke Endoh) over 6 years ago

  • Status changed from Assigned to Closed
ActionsLike0

Also available in: Atom PDF