Project

General

Profile

Actions

Bug #7152

closed

Is the order of Module#instance_methods intended to be preserved?

Added by hasari (Hiro Asari) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin12.2.0]
Backport:
[ruby-core:47950]

Description

https://github.com/jruby/jruby/issues/277 asks this question:

results = 10000.times.map do
chars = ('A'..'Z').map(&:to_sym).shuffle

cls = Class.new do

chars.each do |chr|
  define_method(chr) {}
end

end

chars == cls.instance_methods.take(26)
end

p results.all?{|o|o.equal? true} # => true on MRI

Actions

Also available in: Atom PDF

Like0
Like0Like0