Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74486 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94906 invoked from network); 26 May 2014 08:24:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2014 08:24:23 -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:44937] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9D/75-60353-63AF2835 for ; Mon, 26 May 2014 04:24:22 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 62350200095; Mon, 26 May 2014 04:24:18 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap1.ox.registrar-servers.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 lZuqmlUl4cGH; Mon, 26 May 2014 04:24:17 -0400 (EDT) Received: from [192.168.0.200] (unknown [90.203.28.11]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 3EF9320006B; Mon, 26 May 2014 04:24:12 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <67d97efff27b61e45ef74d4f4339b4b3@mail.gmail.com> Date: Mon, 26 May 2014 09:24:08 +0100 Cc: Dmitry Stogov , Xinchen Hui , PHP Internals , Bob Weinand , Stas Malyshev , Andi Gutmans , Nikita Popov Content-Transfer-Encoding: quoted-printable Message-ID: <962B3020-200F-45D2-8FEC-AD7A0BFDA50E@ajf.me> References: <-6285448086228171932@unknownmsgid> <67d97efff27b61e45ef74d4f4339b4b3@mail.gmail.com> To: Zeev Suraski X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] RE: [RFC] Fast Parameter Parsing API From: ajf@ajf.me (Andrea Faulds) On 26 May 2014, at 08:17, Zeev Suraski wrote: > I think the main challenge is the fact it turns what today is a = one-liner > (albeit a bit obscure) into a long multi-line all-caps gig. I=92ve = tried to > think about alternatives but so far came short with something that > elegantly solves the problem, short of using C++ which I think goes = too far > in the context of what we=92re trying to achieve. Perhaps it could be simplified? Something like this: ZEND_PARSE_PARAMETERS(Z_PARAM_ARRAY, input, Z_PARAM_LONG, offset, = Z_PARAM_OPTIONAL, Z_PARAM_ZVAL, z_length, Z_PARAM_BOOL, preserve_keys); That=92s still rather unwieldy, though. Maybe Z_PARAM could be shortened = to ZP_? Then we=92d have this: ZEND_PARSE_PARAMETERS(ZP_ARRAY, input, ZP_LONG, offset, ZP_OPTIONAL, = ZP_ZVAL, z_length, ZP_BOOL, preserve_keys) That=92s not so bad, right? That would be parsing at runtime instead of = with macros, though. Maybe this? ZEND_PARSE_PARAMETERS(ZP_ARRAY(input), ZP_LONG(offset), ZP_OPTIONAL, = ZP_ZVAL(z_length), ZP_BOOL(preserve_keys)) Except, at least if we=92re only using C89, we can=92t use a nice = function-like macro syntax here. You=92d also still need to explicitly = state numbers of arguments. The first and second proposals are nice = because they requires none of this due to runtime parsing, but it would = be no faster than zend_parse_parameters. Does anyone have a good idea? -- Andrea Faulds http://ajf.me/