Project

General

Profile

Actions

Bug #1322

closed

define_method scope bug

Added by coderrr (coderrr .) about 15 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]
[ruby-core:23050]

Description

=begin
a = 1
Object.send :define_method, :x do
lambda do
p a
a = 2
p a
end.call
end
x(nil)
p a

output is 1,2,1 instead of 1,2,2

details and possible fix: http://coderrr.wordpress.com/2009/03/29/ruby-18-define_method-scope-bug/
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0