ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: mame@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:94673] [Ruby master Feature#15955] UnboundMethod#apply
Date: Fri, 30 Aug 2019 00:05:29 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-81278.20190830000529.b973d549da656363@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15955.20190624174954@ruby-lang.org

Issue #15955 has been updated by mame (Yusuke Endoh).


Matz approved the feature.  The name "apply" was arguable in some terms:

* We may want to use the name "apply" for other purpose in future.
* This API will be used not so frequently.  Only some fundamental libraries (like pp, sorbet-runtime, zeitwerk, etc.) will use it.

I proposed `UnboundMethod#bind_call` at the developers' meeting, and matz liked it.  I'll commit it soon.

----------------------------------------
Feature #15955: UnboundMethod#apply
https://bugs.ruby-lang.org/issues/15955#change-81278

* Author: nelhage (Nelson Elhage)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
I'd love a way to apply an UnboundMethod to a receiver and list of args without having to first `bind` it. I've ended up using `UnboundMethod`s in some hot paths in my application due to our metaprogramming idioms, and the allocation from `.bind` is comparatively expensive.

I'd love `unbound_method.apply(obj, args…)` to be equivalent to `unbound_method.bind(obj).call(args…)` but without allocating the intermediate `Method`



---Files--------------------------------
umethod_apply.patch (5.01 KB)


-- 
https://bugs.ruby-lang.org/

      parent reply	other threads:[~2019-08-30  0:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15955.20190624174954@ruby-lang.org>
2019-06-24 17:49 ` [ruby-core:93337] [Ruby trunk Feature#15955] UnboundMethod#apply nelhage
2019-06-28 10:25 ` [ruby-core:93405] " eregontp
2019-07-25 21:01 ` [ruby-core:93916] [Ruby master " nelhage
2019-07-26 13:48 ` [ruby-core:93933] " jean.boussier
2019-07-26 18:47 ` [ruby-core:93936] " eregontp
2019-07-30  8:13 ` [ruby-core:94040] " ko1
2019-08-13 21:27 ` [ruby-core:94329] " ruby-lang-bugs
2019-08-23  2:40 ` [ruby-core:94493] " mame
2019-08-23  3:28 ` [ruby-core:94495] " mame
2019-08-30  0:05 ` mame [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-81278.20190830000529.b973d549da656363@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).