From: "artemb (Artem Borodkin) via ruby-core" Date: 2024-02-19T13:40:42+00:00 Subject: [ruby-core:116848] [Ruby master Feature#11446] Possible work around for the requirement to supplying arguments like this: .map(&:method, ) Issue #11446 has been updated by artemb (Artem Borodkin). Are there any proposal issues regarding the addition of argument and block support for the ```.each(&:method, args) do; end``` syntax? It seems quite feasible to support it natively. ``` ruby module Enumerable def each_call(method, *args, &) = each { _1.send method, *args, & } def map_call!(method, *args, &) = map! { _1.send method, *args, & } # ... end # [1,2].map! &:+, 1 [1,2].map_call! :+, 1 # [].each &:instance_eval do %w[1 2].each_call :instance_eval do @v = 1 end ``` ---------------------------------------- Feature #11446: Possible work around for the requirement to supplying arguments like this: .map(&:method, ) https://bugs.ruby-lang.org/issues/11446#change-106877 * Author: jikkujose (Jikku Jose) * Status: Open * Priority: Normal ---------------------------------------- Any chance this [work around](http://stackoverflow.com/questions/23695653/can-you-supply-arguments-to-the-mapmethod-syntax-in-ruby/23711606#23711606) can be considered to be part of the language. Seems to be a pretty neat. NB: Matz seems to be interested in having this added: Check his [tweet](https://twitter.com/yukihiro_matz/status/632016695016620033). -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/