Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80369 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85759 invoked from network); 11 Jan 2015 16:40:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2015 16:40:19 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:49018] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/20-18257-177A2B45 for ; Sun, 11 Jan 2015 11:40:18 -0500 Received: by mail-la0-f48.google.com with SMTP id gf13so20845212lab.7 for ; Sun, 11 Jan 2015 08:40:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=sod/vQ0EWLJafM06WnbRJ1+FeEZi9Cy5t6KnX9UeQCM=; b=aYCI0qp/fov/kZiFquEu8tj5vJoXEZzJuHxzRZA42lQA4nOe8sfPKK9614o+MzIkhP 1DNPw+4mpQXCrm6CgwR8bKiVzptGXVT5WUfnuTlZsZHjNxN19ea/35zdYnSjrDKSIs8B gfxOYP5VrxuiMx3NShJG9fbLKzEJYLndcCAZM4eENOjyeZj1XUOr0KxBK0VKsRu53jtM lHRsnE6oq7C4ePiKa6ZImSukeecsojte4TDoMehpleFCJclZVtlOc+BrCzlWgamyMuxU 2thcKVB5fstgdDX4vswag1CJDYIfAzR+6CgHBMBNLS9Y3GKTEegxH3mCyVFBWZCCyZ+s uGug== X-Gm-Message-State: ALoCoQkzF+xaSq30fPqd5uIhWmUH+FdcorORU3jbPGgKvnX1+IQp9ccbQhPY68NwkMYzQtCFiFbo MIME-Version: 1.0 X-Received: by 10.112.12.134 with SMTP id y6mr32382038lbb.34.1420994414807; Sun, 11 Jan 2015 08:40:14 -0800 (PST) Sender: php@golemon.com Received: by 10.112.171.97 with HTTP; Sun, 11 Jan 2015 08:40:14 -0800 (PST) X-Originating-IP: [199.201.64.2] In-Reply-To: References: <54B1AA31.6050703@gmail.com> Date: Sun, 11 Jan 2015 08:40:14 -0800 X-Google-Sender-Auth: sk3kOOXE6xt0DJTjwrlD8_2tN_I Message-ID: To: Pierre Joye 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: pollita@php.net (Sara Golemon) On Sat, Jan 10, 2015 at 11:18 PM, Pierre Joye wrote: > 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. > And this is one of the things I love about HHVM's current extension API, so yeah I'd like to bring some elements of that in if possible. At one extreme it means changes to the lexer/parser, and the other end it might mean a combination of prepend files (which are pure PHP) and either an interface-definition file (simplified version of PHP) or something like PHP's current API "inject a function/method here, and here's the signature". I imagine this being one of the longer portions of our discussions since a lot of folks are going to have opinions on what approach is better. > 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 :) > That's ambitious, but not impossible. :) > 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). > PHP as the greatest-common-denominator makes sense to me too. Much as I like the flexibility of user attributes in HHVM, the goal of this API layer is to be engine agnostic, so syntax should fall into php-langspec, deviating as little as possible. -Sara