Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77054 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65953 invoked from network); 4 Sep 2014 12:27:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2014 12:27:52 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:36733] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/22-53069-6CA58045 for ; Thu, 04 Sep 2014 08:27:51 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 09A81B00087; Thu, 4 Sep 2014 08:27:48 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rGkENWJeXJUk; Thu, 4 Sep 2014 08:27:47 -0400 (EDT) Received: from [192.168.0.2] (05439dda.skybroadband.com [5.67.157.218]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 27680B0007B; Thu, 4 Sep 2014 08:27:45 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 4 Sep 2014 13:27:43 +0100 Cc: PHP internals , Dmitry Stogov Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Bob Weinand X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] Fast zend_parse_parameters API From: ajf@ajf.me (Andrea Faulds) On 4 Sep 2014, at 13:23, Bob Weinand wrote: > After a long time=85 back to our fast_zpp RFC. >=20 > 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 >=20 > 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 = globally 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). >=20 > 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) This is actually quite an interesting idea. If you think about it, = there=92s no reason the macros couldn=92t expand to = zend_parse_parameters. >=20 > Also, there is the question about how to structure the API; we (I and = Dmitry) basically have now two different proposals: >=20 >=20 > 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); >=20 >=20 > OR >=20 >=20 > 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; > }) >=20 >=20 > 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. Neither is that good, though I might prefer the first one. Perhaps we should move this out of functions altogether, and instead = have parameter types be attributes of the function? I=92m not sure if = it=92s possible, but it would be awesome if we could just put the types = where we have our parameter names in our info structs, and it would just = magically call the C function with the right types. -- Andrea Faulds http://ajf.me/