Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108560 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82224 invoked from network); 14 Feb 2020 10:08:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Feb 2020 10:08:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C8CEA1804E6 for ; Fri, 14 Feb 2020 00:23:14 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MISSING_HEADERS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 14 Feb 2020 00:23:14 -0800 (PST) Received: by mail-wr1-f52.google.com with SMTP id t3so9853014wru.7 for ; Fri, 14 Feb 2020 00:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:cc:from:message-id; bh=6RKNgs32gUfwX34Fi7sqVDsw4sC2/mzVc5qIE+eTWNo=; b=Tt1aQTtQBsPe9JPhdgLwUAeupScLfBSBLIPPEA43VdKpE3Bvz6sHZjOfpNbyZjD/vg +iOn5yDSuEGO+dp4Vtni9BNUhLcbKSd9nCXGllf3Lwcq3Jvli4S1MaAXzCSGgiZDHb97 0BK9Hcy32k9DtxX/ITdzCknUO5PI1lpPFvbGfcmNBF6wWiTqk782iui3vAzHmCbGcCKq AXkK0RcLHdur2FzqQz1onuOudgrRXE2fOLgs18RZljm3dsuNcRBp+71LYVSO3HFU2i66 m660eEd17PpU9qf6QMdt+OYTYCIsXClRgsDNYwt3zYLJs5Z7ost7ralLDm9Dg8H4vye5 0FHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:cc:from:message-id; bh=6RKNgs32gUfwX34Fi7sqVDsw4sC2/mzVc5qIE+eTWNo=; b=tu+gkzT8PdlUFPRUwYDLCVQCxCu0ITEYS2aFs7rMt0Cmi/TThXTl5qMbNk0fGn/u+j 2mbN9uUzGVaYWf2FgmQ5Iy9+AGT93Ht6fLa641U8i66GpcEVwmBEKB4h0lO8mcEIa+RS cF6jyZ+tJZ4LsKUHx/r+QZ2WYk1zbi8G70bbBZXLMjE4DIHg+CHkkqwTFzN8RqID+6Wu SglnxCgFnzfhHHyRaMMd+zvTAfCquWfRexPohICGb+huIRQ4gdKQo1+YNAYWbXigoc4B vqUv2EKNivXAVYUhjBv6JRAhFV+zdVYSVToO/9NzxIC2NmlhEcZjszuaUgvljj16yWmU 0ipQ== X-Gm-Message-State: APjAAAXzXOdw/cK9U62wbKp/tbonQ3NtRobEUZpQ9dbZspO3sameVBxF wlF0qOHGk5TkqEkap3bono8Z8e+Z X-Google-Smtp-Source: APXvYqx0mZpj75eCLEA0gtsQjxjd8sYNM47LwBQT9knDIHfEu1Swdg503I/dk52XZ4uZfPyi6ZF2DA== X-Received: by 2002:a5d:6b82:: with SMTP id n2mr2812861wrx.153.1581668590298; Fri, 14 Feb 2020 00:23:10 -0800 (PST) Received: from [192.168.0.12] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.gmail.com with ESMTPSA id t13sm6113858wrw.19.2020.02.14.00.23.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Feb 2020 00:23:09 -0800 (PST) Date: Fri, 14 Feb 2020 08:23:06 +0000 User-Agent: K-9 Mail for Android In-Reply-To: <938FDD44-1F60-4FE1-B0F1-E70284F5F2D2@newclarity.net> References: <10FCCCED-B8AE-4394-91B3-0FEB448E2398@gmail.com> <2C404984-AD76-4CDF-8E1A-04DF8EF024DD@newclarity.net> <0BE8FC1E-A9BF-4A2A-9CA5-59BEE1245632@gmail.com> <938FDD44-1F60-4FE1-B0F1-E70284F5F2D2@newclarity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable CC: PHP internals Message-ID: Subject: Re: [PHP-DEV] [RFC] From: rowan.collins@gmail.com (Rowan Tommins) On 14 February 2020 00:39:15 GMT+00:00, Mike Schinkel wrote: >> On Feb 13, 2020, at 7:24 PM, Rowan Tommins >wrote: >>=20 >> An idea I had earlier which might solve some of them is if what was >returned was not a normal Closure instance, but a new class like >FunctionReference=2E It could then "remember" the name of the function >wrapped, and implement __toString, Serializable, etc=2E It could inherit >from Closure, so instanceof checks would work, and bindTo would return >a normal Closure=2E I'm sure there's downsides I haven't thought of yet, >but I thought I'd throw the idea into the mix=2E > >I thought about that too, and mentioned it yesterday in a reply[1] to >you on this list=2E > >Here is the link to the Gist with the hypothetical code using such a >concept:=20 > >- https://gist=2Egithub=2Ecom/mikeschinkel/78684d708358e1d101e319c7a2fdef= 9c What I had in mind was a combination of that and the existing Closure clas= s, so: $ref =3D foo::fn; $ref(); // run the function $ref->name; // access extra metadata $ref->bindTo($whatever); // get a new Closure with a bound context That would also combine well with one of the proposed bracket style syntax= es that let you specify methods more naturally: {foo}->name; // qualified name of local function {Foo::bar}; // closure for a static method {$this->baz}->bindTo($that); // closure for a method of current class rebo= und to a different object Regards, --=20 Rowan Tommins [IMSoP]