Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76439 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63817 invoked from network); 11 Aug 2014 20:46:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2014 20:46:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.50 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.215.50 mail-la0-f50.google.com Received: from [209.85.215.50] ([209.85.215.50:63655] helo=mail-la0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/12-53075-5BB29E35 for ; Mon, 11 Aug 2014 16:46:45 -0400 Received: by mail-la0-f50.google.com with SMTP id pi18so144821lab.37 for ; Mon, 11 Aug 2014 13:47:23 -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=QIVzV2/yMH8nE5L9KvY2HKGKioGtNeTSdBMjk7zZDfA=; b=lOMaesit794vueEUVLuvu4OzuLQkhkTclMFFjsPtbb+OmPmuIlQS9CHysy4uoqjCQf p+/SVbvjMZlj9jqb9qWRwCDFohso/GSfnv74D70lmw1GbwHRYublDISp+s3+9uc4TPCK r/GAvotOKBCtg+JyvfjanS6rt89e51pAccaW5iHF8EZLqghMZxLp7gQobvQTo5vUdQaE tkgSbX7vmjUaVVsmadcOVU48/GMQyoVH2Oc2nfGJEucha6YZuzr7Sp3ZM7RevIp/yEkz 1SJ43Q5I3OLzOIzey3apowZpiHuH0Gw6xtYUbDBAqeAxJMEs1RLHxp4Vgr+tq6NZHH3/ Q31Q== MIME-Version: 1.0 X-Received: by 10.112.224.9 with SMTP id qy9mr140593lbc.57.1407790043436; Mon, 11 Aug 2014 13:47:23 -0700 (PDT) Sender: mike.php.net@gmail.com Received: by 10.114.233.71 with HTTP; Mon, 11 Aug 2014 13:47:23 -0700 (PDT) Received: by 10.114.233.71 with HTTP; Mon, 11 Aug 2014 13:47:23 -0700 (PDT) In-Reply-To: References: <35D0408F-BCE1-436C-AFB3-71EDC2A35E1F@ajf.me> Date: Mon, 11 Aug 2014 22:47:23 +0200 X-Google-Sender-Auth: MMIJfzs3bQ29bu5rKPAbaLF6yPo Message-ID: To: Dmitry Stogov Cc: PHP Internals , Andrea Faulds Content-Type: multipart/alternative; boundary=001a11349f14751df5050060a9bd Subject: Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures From: mike@php.net (Michael Wallner) --001a11349f14751df5050060a9bd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable How about 'new Function()'? Might be a WTF that it creates an instance of Closure, though. On 11 Aug 2014 22:32, "Dmitry Stogov" wrote: > We didn't keep pointers to functions in opcodes (however it possible in > some cases). > Instead we use cache_slots in op_array->run_time_cache array to keep > pointers to classes and functions. > Anyway, it must be quite easy to extend the patch. > > Thanks. Dmitry. > > > > On Mon, Aug 11, 2014 at 11:33 PM, Andrea Faulds wrote: > > > > > On 11 Aug 2014, at 20:07, Dmitry Stogov wrote: > > > > > > > > may be: > > > > > > $a =3D function strlen; > > > > > > or > > > > > > $a =3D function(stren); > > > > > > but these are not excellent as well :( > > > > I wanted to do the first, but it caused a shift/reduce conflict in the > > parser due to ambiguity with function () {}. The latter has been > suggested > > also. Both might be possible with an AST, but I=E2=80=99m not really ke= en on > > either, they=E2=80=99re quite verbose. > > > > > I may implement this part if the RFC will be accepted. > > > Actually, most of the code may be just copy-pasted from > > > ZEND_INIT_STATIC_METHOD_CALL. > > > > Interesting, I=E2=80=99d certainly appreciate it. :) One thing to note = is that > the > > patch is currently implemented in the simplest way possible, wherein it > > just stores constant strings in the opcode. You could optimise it by > > binding ahead-of-time and passing the zend_function pointer itself, but= I > > didn=E2=80=99t want to do that as it complicated things. > > > > -- > > Andrea Faulds > > http://ajf.me/ > > > > > > > > > > > --001a11349f14751df5050060a9bd--