Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76438 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62074 invoked from network); 11 Aug 2014 20:31:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2014 20:31:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.180 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.180 mail-vc0-f180.google.com Received: from [209.85.220.180] ([209.85.220.180:36072] helo=mail-vc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/B1-53075-03829E35 for ; Mon, 11 Aug 2014 16:31:45 -0400 Received: by mail-vc0-f180.google.com with SMTP id ij19so11959775vcb.25 for ; Mon, 11 Aug 2014 13:32:24 -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=m5lIVdKv4HB2R0yyBn6meqxfUiwixLUHQ28QM/QlJz8=; b=DYocGflPRUjdP6VYck3plgX20Ds027NVYyo0ksD4uabmUZq+/kYPTii6pk7YTQtYhC yvJuzVkYSNv+kYipSYJ3Q/94rV+TeXRI4KL6gLs9hX39aZDXM/7GV3pW10tfe8ViCDAJ MR/WjOts8+zGI00WD6Emo/AvTdL3643GcnDyxcoWQjcpbChmGpb9GOJX6l3XKBYJFNB5 PLBp9zzFcqtDKfR3YYesrYOuu6g2epZIQciWHTYMHWNffvYYZxSGLXKSICw5dCvVki0F 1B87kfUoCDME1dv5RawRP8f4R3GMFzr5TEBVtCE9QIerZTSq/G3l7duzjEOld3sOKUiO NsQw== X-Gm-Message-State: ALoCoQkFfWMmmE871qSIAN0iF/vFkhHhH/k/LHaUJ1YWkq2/dEopVbhwmyQU/ITPML9P9Qnc0d/8bdkElUmdG2rgqebxIs2zqw16Pad/G4Role2E2jRVf75igE+6lDJA8kYs8IK3KqLu MIME-Version: 1.0 X-Received: by 10.221.9.72 with SMTP id ov8mr79453vcb.27.1407789143892; Mon, 11 Aug 2014 13:32:23 -0700 (PDT) Received: by 10.52.110.170 with HTTP; Mon, 11 Aug 2014 13:32:23 -0700 (PDT) In-Reply-To: <35D0408F-BCE1-436C-AFB3-71EDC2A35E1F@ajf.me> References: <35D0408F-BCE1-436C-AFB3-71EDC2A35E1F@ajf.me> Date: Tue, 12 Aug 2014 00:32:23 +0400 Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: multipart/alternative; boundary=089e01177721d73a760500607325 Subject: Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures From: dmitry@zend.com (Dmitry Stogov) --089e01177721d73a760500607325 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 suggeste= d > also. Both might be possible with an AST, but I=E2=80=99m not really keen= 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/ > > > > > --089e01177721d73a760500607325--