Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77056 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78389 invoked from network); 4 Sep 2014 13:57:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2014 13:57:03 -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.181 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:47767] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/94-53069-EAF68045 for ; Thu, 04 Sep 2014 09:57:02 -0400 Received: by mail-vc0-f181.google.com with SMTP id ij19so10562758vcb.40 for ; Thu, 04 Sep 2014 06:56:59 -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=cBgqJM2rZOwal8YBfuw3NlLdaJgFFcP+1rM2jtYf7ow=; b=Xj5B4rlvVWpM/XWw2QFYIS7Sz+58Qb5mRGg+amOwnXv+c80SOUBv/NAvsZCQstYl/6 NxIy37PRvk9vR/b6Q7KQBFxdRXHO/x7/Qr2bBELiemZSyybuD6XOyyRrNkzEkvZ/30aT EYm1Ane+GpgFiIP8vLgas2AJqC1vEV8iYb6RYHRp5tFoQp1gcYNpZkiKjMxXgexVGbqB 0KxmdiHd9ovbWtzKzqsBvJuh/KNp1DE16Z1pSE8LVpTAGbbfiV2Tnh64uJHvjFCL2Kxl 7t0v9CVdhhaZiAJykfv5AyXYeqlmyp1H+txwxEGv0nDADdOOC8TKw8FQCjWhquNXtRri CGKw== X-Gm-Message-State: ALoCoQk5R769Zo6/w1dBG7YxDYBtSq1dd7CuqwZMYfyZGsYmd9x71WHN1iFgVyzaLDMVUIEVDbnhj7rNUcNRvCsvaFSWJyAq6GAPbP3nVwxoOCN1VAtsRjZT2mOVoRvPJGJwV1Gjf1dmjM+h2IZHsoiT3E8fMMQRJQ== MIME-Version: 1.0 X-Received: by 10.220.114.66 with SMTP id d2mr3910418vcq.27.1409839019455; Thu, 04 Sep 2014 06:56:59 -0700 (PDT) Received: by 10.52.110.170 with HTTP; Thu, 4 Sep 2014 06:56:59 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Sep 2014 17:56:59 +0400 Message-ID: To: Bob Weinand Cc: PHP internals Content-Type: multipart/alternative; boundary=089e013c6d20f2110005023db9b3 Subject: Re: Fast zend_parse_parameters API From: dmitry@zend.com (Dmitry Stogov) --089e013c6d20f2110005023db9b3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I like the idea of having a single syntax for all cases, but I don't like the syntax you propose. In my opinion, it's syntactically inconsistent, less readable and more error prone, than the old one (sscanf based) and the FAST_ZPP one that is already in php-master. I would also prefer to have an ability to select which function should use "fast" parameter parsing individually. (You propose use "fast" for all functions, or enable it per extension) Using "fast" parsing for all functions may significantly increase code size and slowdown execution, but we won't know it for sure until we didn't try it. Anyway, if we find a good single syntax, we must be able to solve technical problems. Opinions and other syntax ideas would help us to do our best :) Thanks. Dmitry. On Thu, Sep 4, 2014 at 4:23 PM, Bob Weinand wrote: > After a long time=E2=80=A6 back to our fast_zpp RFC. > > Initially Dmitry proposed to have two different APIs, one for the fast > version, one for current version: > #if FAST_ZPP > /* new API */ > #else > /* old style zend_parse_parameters API */ > #endif > > I don't really like the idea of having two different APIs, so I'd rather > propose to use one same public API for both. > That API should, depending on some compile-time flag (per file or globall= y > in zend_API.h), either convert to the usual variadic style function, or > expand to the new fast variant of API parsing (with directly inlining > parameter type specific functions). > > What do you think about having one unified API for both, instead of the > current (like it's in some places in master branch currently)? > (p.s.: The rewrite of the current API can be done safely via some PHP > script I wrote) > > Also, there is the question about how to structure the API; we (I and > Dmitry) basically have now two different proposals: > > > ZEND_PARSE_PARAMETERS_START(3, 5) > Z_PARAM_ZVAL(regex) > Z_PARAM_ZVAL(replace) > Z_PARAM_ZVAL(subject) > Z_PARAM_OPTIONAL > Z_PARAM_LONG(limit) > Z_PARAM_ZVAL_EX(zcount, 0, 1) > ZEND_PARSE_PARAMETERS_END_EX(return); > > > OR > > > zend_parse_parameters(ZPP_ZVAL(regex) ZPP_ZVAL(replace) ZPP_ZVAL(subject) > ZPP_OPTIONAL ZPP_LONG(limit) ZPP_ZVAL_EX(zcount, ZPP_BY_REF), { > return; > }) > > > We'd like to have some discussions about what API to use for the next > years. If you have some better API, feel free to propose it. > > Thanks, > Bob > --089e013c6d20f2110005023db9b3--