Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74255 invoked from network); 12 Jan 2015 04:10:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jan 2015 04:10:42 -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.215.43 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.215.43 mail-la0-f43.google.com Received: from [209.85.215.43] ([209.85.215.43:46047] helo=mail-la0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B5/00-08273-04943B45 for ; Sun, 11 Jan 2015 23:10:41 -0500 Received: by mail-la0-f43.google.com with SMTP id s18so22150499lam.2 for ; Sun, 11 Jan 2015 20:10:38 -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=BlwS+ErmvfUoa0wXZx/0bA6XmHwBtwPxruA/Cfaspvo=; b=ZGhqRkeZYFP4GTd4GE+nLwmYDFHIVV+pZDg+rkjhd0fyukPD7uUMd3KUcmC4kXAbag c0FRpvIj8V0Ax0Df9biesnZN74YDfe3Q+6ZicTz2IiF/nPMFACOF2ho+dG/m4eUmjomF prbJRHABszD3Q7JKPIS5SuQOXnRgdcCF7fIUn6TKIiEi/g3/BaJqkcIedhEqCAeOLlLk 3LtvZSzs/xsvAagasS2I2Y9+DGP0DG29p2SHrAhocIHaPOn71Lf8+E+FifukP4r2kzfB z+Tn03xGC1nGZ7AFqIucAo3bOH1J4pjlYi4JY/IrpWkUWtUFy3QI6mCjvUED9vs7QXpf NsnA== MIME-Version: 1.0 X-Received: by 10.112.167.136 with SMTP id zo8mr34727193lbb.17.1421035838191; Sun, 11 Jan 2015 20:10:38 -0800 (PST) Received: by 10.112.154.133 with HTTP; Sun, 11 Jan 2015 20:10:37 -0800 (PST) Received: by 10.112.154.133 with HTTP; Sun, 11 Jan 2015 20:10:37 -0800 (PST) In-Reply-To: <005a01d02e1a$02d27a00$08776e00$@tekwire.net> References: <54B1AA31.6050703@gmail.com> <003901d02de5$53732480$fa596d80$@tekwire.net> <005a01d02e1a$02d27a00$08776e00$@tekwire.net> Date: Sun, 11 Jan 2015 20:10:37 -0800 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: PHP internals , Stas Malyshev , Sara Golemon Content-Type: multipart/alternative; boundary=001a11c2a4a85941d1050c6cb0b5 Subject: RE: [PHP-DEV] One API to rule them all? (Was: Extension Prepend Files) From: pierre.php@gmail.com (Pierre Joye) --001a11c2a4a85941d1050c6cb0b5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Jan 12, 2015 10:44 AM, "Fran=C3=A7ois Laupretre" = wrote: > > > De : Fran=C3=A7ois Laupretre [mailto:francois@tekwire.net] > > > > If you agree, I propose this as a base to refine: > > > > - Extension exposes only PHP functions and constants (no OO), > > - Each PHP function argument must accept a scalar, an array, or both ('mixed' > > case). > > - one or more PHP function arguments can be optional > > - PHP function arguments can be passed by value or by reference. > > Adding these rules : > > - Constant values must be static (cannot be computed during MINIT). > - During MINIT and MSHUTDOWN, no activity excepts defining/undefining functions and constants. > - No activity during RINIT/RSHUTDOWN. > > And changing this one : > > > - PHP functions return value type can be any scalar type or array. > > To: > > PHP functions return value must be a fixed type (cannot return different types depending on context). Return value type can be null, bool, long, double, string, or array. > > The resulting ruleset : > > - Extension exposes only PHP functions and constants (no OO), > - Each PHP function argument must accept a scalar, an array, or both ('mixed' case). > - one or more PHP function arguments can be optional > - PHP function arguments can be passed by value or by reference. > - PHP functions return value must be a fixed type (cannot return different types depending on context). Return value type can be null, bool, long, double, string, or array. > - Constant value must be static (cannot be computed during MINIT). > > I have pushed a first half-baked version of the extension generator I was thinking about. Just for a look, don't try to run it. I started with json and yaml support for metadata definition. We can easily add another supported syntax if needed but these should be enough. Look at https://github.com/flaupretre/php-ext-gen/tree/develop Would it not be better to work on one only? Also I am really not a fan of yaml&co to generate C code but having critical parts in C and everything else in straight php :) > Fran=C3=A7ois > > --001a11c2a4a85941d1050c6cb0b5--