This behavior of reduce is unpredictable and different of the another Enumerable methods.
Users will expect that symbol argument is converted in proc and then applied to object.
reduce (since v1.8.7) is older than public_send (since 1.9.1), maybe this is the reason of the reduce works like that.
But these days, as we have public_send and the :symbol.to_proc works similar to public_send I think make sense the reduce works with :symbol.to_proc, and not reaching private methods.
Hanmac (Hans Mackowiak) wrote:
reduce(&:+) is different from
reduce(:+), this one has nothing to do with :+.to_proc
reduce/inject with symbol param does call the method internally without checking if its private or not
i think you still mix reduce(&:+) with reduce(:+)
both are two totally different ways to call this method.
(the later doesn't go the way with a Proc object)
Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: WONTFIX, 2.3: WONTFIX, 2.4: UNKNOWN
memo: I think this is a bug, but it may cause some compatibility problems to change the behavior in teeny release, then I decided not to backport this to ruby_2_3.