[ruby-core:94700] [Ruby master Bug#16127] Delegates to BasicObject do not work
From:
fg@...
Date:
2019-08-31 12:21:26 UTC
List:
ruby-core #94700
Issue #16127 has been updated by decuplet (Nikita Shilnikov). With `UnboundMethod#bind_call` added in https://bugs.ruby-lang.org/projects/ruby-trunk/repository/git/revisions/83c6a1ef454c51ad1c0ca58e8a95fd67a033f710, we should be able to save some allocations by assigning `::Kernel.instance_method(:respond_to?)` to a constant and calling with `.bind_call`. WDYT? Not a big deal, I just don't like the idea we allocate objects when merely calling a method. ---------------------------------------- Bug #16127: Delegates to BasicObject do not work https://bugs.ruby-lang.org/issues/16127#change-81309 * Author: jeremyevans0 (Jeremy Evans) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0dev (2019-08-25) [x86_64-openbsd6.5] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- The delegate library does not currently handle BasicObject targets, since it assumes the target responds to `respond_to?`. The attached patch works around the issue by binding the Kernel `respond_to?` instance method to the target and then calling that. ---Files-------------------------------- delegate-basicobject.patch (2.29 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>