Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76443 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74520 invoked from network); 11 Aug 2014 22:12:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2014 22:12:41 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:44237] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/01-03357-7DF39E35 for ; Mon, 11 Aug 2014 18:12:40 -0400 Received: by mail-vc0-f170.google.com with SMTP id lf12so12453725vcb.29 for ; Mon, 11 Aug 2014 15:13:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ynMhjXrZcKH3imX7prZBA+pNkqBaWq5kcwK7wLHVzhM=; b=MooaRLZF00p7qFycnEawnjDmUO+skD+JZOddc+JClj/TIY4SMbRT1Z85JBlSupziTo WH2ayjzuH1fFo4/HP8bcl2AlIQgJ1sbHMv7WNIFgWSxYcfj1SLe4Cy43WYZ1N/u0jHfx ecT6roU6c9fvhOzf/3MlklEd1G+8jzl1GFqh+17K2eWLIzuZBe7LgdZSh+FlayC+21p/ Beza85tOLDKxancxOIRBXJuOfnKZoaacgx1m1s/USB3PrZqyuSCtsahWiKh1S1fJcDM4 1L/RM077X054UXzlaMOEehBWaTQa4ZwGEsBy9XQITOu3/CCu/rg1wb7vLWXf5SiTS1MA J27g== X-Gm-Message-State: ALoCoQkuSUKcJNN8LsTaDmL8vFx8q7urAXqMSSzbIjR0pkhXh5/d1sJskV3WydwQP2TXhAAM83OkT1rj7Yv86DhPVeIq+gxIXf8SH4a0mGPVLXnfgTPInhsKhhBkx0mC7p/wjwIMcwCz MIME-Version: 1.0 X-Received: by 10.220.122.132 with SMTP id l4mr401092vcr.41.1407795198634; Mon, 11 Aug 2014 15:13:18 -0700 (PDT) Received: by 10.52.110.170 with HTTP; Mon, 11 Aug 2014 15:13:18 -0700 (PDT) In-Reply-To: References: <35D0408F-BCE1-436C-AFB3-71EDC2A35E1F@ajf.me> Date: Tue, 12 Aug 2014 02:13:18 +0400 Message-ID: To: Michael Wallner Cc: PHP Internals , Andrea Faulds Content-Type: multipart/alternative; boundary=089e0118263cbb3fcd050061dc59 Subject: Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures From: dmitry@zend.com (Dmitry Stogov) --089e0118263cbb3fcd050061dc59 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable it's ambiguous with regular object creation. Thanks. Dmitry. On Tue, Aug 12, 2014 at 12:47 AM, Michael Wallner wrote: > 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 k= een 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 i= t >> > just stores constant strings in the opcode. You could optimise it by >> > binding ahead-of-time and passing the zend_function pointer itself, bu= t >> I >> > didn=E2=80=99t want to do that as it complicated things. >> > >> > -- >> > Andrea Faulds >> > http://ajf.me/ >> > >> > >> > >> > >> > >> > --089e0118263cbb3fcd050061dc59--