Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76740 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82527 invoked from network); 20 Aug 2014 19:30:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Aug 2014 19:30:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.48 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.219.48 mail-oa0-f48.google.com Received: from [209.85.219.48] ([209.85.219.48:38712] helo=mail-oa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/9B-29327-447F4F35 for ; Wed, 20 Aug 2014 15:30:13 -0400 Received: by mail-oa0-f48.google.com with SMTP id m1so6695538oag.21 for ; Wed, 20 Aug 2014 12:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=thfAVTHWsjmCKF62fZQaLy+Ui4d0LtR6GKt8HS6P3XM=; b=oZXAYKRfhKh501l8OmEUGxzCqNh/rpSqC9q+59E6xpkisGyE9PbwjvTcsdLfKjEfuN KLeRNFrsU+r94I7xpCHdnnOIrzsIWJ0B7k+GAYaaFRMb9oF5xG72CXqTesnwRI6mYFKG H8jxlIx1qJUOYprKgU+q6ZAO7BxJVTAXKltbHjEGzyR9GNMcoZYWvSH3b91mRdylK2g0 4G0qXlK+jNy1wr4kEhpokVynJxgtrIj4Om9gU5jvcjezU6KQUh+x+gAn/fh6LdSzlKxm I34j4t+NA525W7Pb8jVpGu4dqVd7RDSKQDMxazcRRaPBZkQ4soG6NiXTqbVS/DDE/0WT XLLg== MIME-Version: 1.0 X-Received: by 10.60.15.37 with SMTP id u5mr50794578oec.12.1408563010214; Wed, 20 Aug 2014 12:30:10 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.76.7.41 with HTTP; Wed, 20 Aug 2014 12:30:10 -0700 (PDT) In-Reply-To: References: Date: Wed, 20 Aug 2014 13:30:10 -0600 X-Google-Sender-Auth: oZrVuNsyECcIf6D3K_XL-uxlK5o Message-ID: To: Nathan Cc: Andrea Faulds , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [VOTE][RFC] Closure::apply() (re-opening) From: levim@php.net (Levi Morrison) On Wed, Aug 20, 2014 at 11:51 AM, Nathan wrote: > The only thing I'd suggest is like I said in the last email is to make the > syntax more like Closure::bind(Closure $closure, object $newThis, [mixed > $newScope = 'static']) and make it Closure::apply(mixed $newObjectOrScope > [, mixed ... $parameters]) $newObjectOrScope would then allow a user to > supply a class name or an object. If class name is passed you have access > to "static::", "self::", and "parent::" inside the function everything else > works as described in the RFC. > > Give the ability to call a closure as a static method of a class or a > normal method of an object. Right now the only way to do it is doing > binding and creating new closures and calling those closures then > destroying them. I think you are confused. This proposal basically binds the closure to the new object and invokes it immediately. I genuinely don't see how it being statically bound to the object will make a difference. Please elaborate.