From: adriano.mitre@... Date: 2016-07-29T19:36:54+00:00 Subject: [ruby-core:76614] [Ruby trunk Bug#12638] Symbol#to_proc probable bug (seems not to support refinements) Issue #12638 has been reported by Adriano Mitre. ---------------------------------------- Bug #12638: Symbol#to_proc probable bug (seems not to support refinements) https://bugs.ruby-lang.org/issues/12638 * Author: Adriano Mitre * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- It is my understanding that ~~~ v.map { |x| x.foobar } ~~~ should always be equivalent to ~~~ v.map(&:foobar) ~~~ The following shows a case, involving refinements, where this is not the case. ~~~ module MyExtensions refine Object do def foobar self end end end class MyClass using MyExtensions def self.ok(ary) ary.map { |x| x.foobar } end def self.error(ary) ary.map(&:foobar) end end MyClass.ok([1]) #=> [1] MyClass.error([1]) #=> NoMethodError: undefined method `foobar' for 1:Fixnum ~~~ PS: also affects ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] -- https://bugs.ruby-lang.org/ Unsubscribe: