Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80359 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51717 invoked from network); 11 Jan 2015 07:18:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2015 07:18:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.169 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.217.169 mail-lb0-f169.google.com Received: from [209.85.217.169] ([209.85.217.169:45172] helo=mail-lb0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/FF-48183-9B322B45 for ; Sun, 11 Jan 2015 02:18:17 -0500 Received: by mail-lb0-f169.google.com with SMTP id p9so13631486lbv.0 for ; Sat, 10 Jan 2015 23:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=0wQJ584zoZIRUPkRM7R2DXupQXZbLgTt2JNDV/HHz8g=; b=THRTPjbaDQ0cJS3PKlOEpJ9wyijRMpC+JelrgB7IMcMDIL1AIy4gVLTyNS4uTndNDf s7bMG5JB18bwQiteoPxZXxBZONBHdPdzH6HvLJNPm1iSGcz4u6i9b2ZQ37lJebJGCI79 BJQl/uUXa/RiSxtFClUf3xGMS59NqVEfT481Hi2G/JPCDSc2bkpOXN3NoAROfhTVciTo jW3Zdp+pCpzlgiEfWT0/OUoDjFl01sKRK/iDnWikUjIZTiqAzeBW9IgP/F0dOs4GKayf HK56aT1xe2IfsYtEqMxc0L0DeCcbzMCleyluRdSYZAb6V3xXGNI71TpJiJl5DwcLKAMq NNYw== MIME-Version: 1.0 X-Received: by 10.112.43.66 with SMTP id u2mr30694192lbl.35.1420960694139; Sat, 10 Jan 2015 23:18:14 -0800 (PST) Received: by 10.112.154.133 with HTTP; Sat, 10 Jan 2015 23:18:14 -0800 (PST) In-Reply-To: References: <54B1AA31.6050703@gmail.com> Date: Sat, 10 Jan 2015 23:18:14 -0800 Message-ID: To: Sara Golemon Cc: Stanislav Malyshev , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] One API to rule them all? (Was: Extension Prepend Files) From: pierre.php@gmail.com (Pierre Joye) On Sat, Jan 10, 2015 at 8:08 PM, Sara Golemon wrote: > On Sat, Jan 10, 2015 at 2:39 PM, Stanislav Malyshev wrote: >> So I think it would be useful to define what exactly would be covered >> and what not, i.e. which APIs are supported, which can be supported, >> which can not. Right now we don't even have the API as such for the >> engine itself (i.e., you can just go to EG(...) or bits of the zval and >> mess with them, and not only you can but many extensions do). >> > My idea is to cover *most* (but not all) extensions with a narrower, > simplified API. As you say, many interactions fall into the "marshal > this engine value to a C type as needed". This can cater to the > bread-and-butter of PHP extensions very well. > More than adding a new layer, I would love to see something similar to hhvm or Zephir available by default. If C is used, then only the relevant parts have to be implement by the developers, skipping all the over complicated data mangling, swapping, exchange, etc between userland and the engine. It is then relatively easy to end up generating codes for either php, hhvm or any other platform. Using builtin script (yes, in this case it could be a nice thing), it could became a very nice way to develop php&co extensions. For what I can imagine (I did not remotely try to implement it yet) is to find a way to parse, say, a php script which include custom sections for C (or C++) codes. We could use comments but I do not like the idea, mainly because it will be tricky to have editors support :) One problem, I do not think it is possible to customize the current lexer to allow that on demand, but it could be possible using a more modern lexer tools. I am not sure how flexible the hhvm lexer is or if we should have yet another language (as I would rather use plain PHP in this case, even if it makes the task slightly harder to implement or generate slightly bigger native code due to type checking or conversions). Cheers, -- Pierre @pierrejoye | http://www.libgd.org