Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74489 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99851 invoked from network); 26 May 2014 08:43:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2014 08:43:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.128.179 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.128.179 mail-ve0-f179.google.com Received: from [209.85.128.179] ([209.85.128.179:49865] helo=mail-ve0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/86-60353-D9EF2835 for ; Mon, 26 May 2014 04:43:10 -0400 Received: by mail-ve0-f179.google.com with SMTP id oy12so9012495veb.10 for ; Mon, 26 May 2014 01:43:06 -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=ERjsUqrcRM5Nq/KRAxcM0zt6q86FcaBSFyrZsNWL4uE=; b=EmvtCzEgo1q8uAY31NDH0ZxBmnBrop7avVAJSZ8yPuCBPQF4VscQKgatmw1FONmzOV dnWkEuINJTIj7lExDwb0vGYiEzl0jvc8ctCzhA2t2nRER7kVud6sZUgn96WVpr+D1FAl gqGxcYL97YtWTTfjN3pd16LzmZGmduduohAXdN7gmGtKqmc7NNkziXg5vs3yOEz8U+6Z WqGjG6c0s2d/nhP6VEfaUEbxHLigfTKwNxHCmzAT7xuvVLMBjVAOdq5oV6Jxz/iVWBS8 jbU0hoZVQwmkCqGqxxxlNcg8o7ikNGmAK0P8wu4Gi9S09LDwU46dgzs+enYhy8ICFPtH anow== X-Gm-Message-State: ALoCoQlejSd52xqsYJ3+i98aG60eJA7QLuRkIUinu4TxlDMP2+jcw4kf3GwonnRa/nC9/UpJ/6rqhrM74rkFwhBkuQdEy/13CdJGGVt9LbFcmjNIZY3RDhbFyYgS6YRNTrt4DuLQReJG MIME-Version: 1.0 X-Received: by 10.58.188.37 with SMTP id fx5mr20919030vec.17.1401093786449; Mon, 26 May 2014 01:43:06 -0700 (PDT) Received: by 10.52.111.71 with HTTP; Mon, 26 May 2014 01:43:06 -0700 (PDT) In-Reply-To: <962B3020-200F-45D2-8FEC-AD7A0BFDA50E@ajf.me> References: <-6285448086228171932@unknownmsgid> <67d97efff27b61e45ef74d4f4339b4b3@mail.gmail.com> <962B3020-200F-45D2-8FEC-AD7A0BFDA50E@ajf.me> Date: Mon, 26 May 2014 12:43:06 +0400 Message-ID: To: Andrea Faulds Cc: Zeev Suraski , Xinchen Hui , PHP Internals , Bob Weinand , Stas Malyshev , Andi Gutmans , Nikita Popov Content-Type: multipart/alternative; boundary=089e01183d0a7051d804fa499147 Subject: Re: [PHP-DEV] RE: [RFC] Fast Parameter Parsing API From: dmitry@zend.com (Dmitry Stogov) --089e01183d0a7051d804fa499147 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I more or less like the last option, and actually it's similar to Bob original proposal. But I see two disadvantages: 1) It'll relay on macros with variable arguments and it may be not portable across all compilers. 2) It uses nested macros and it may make a nightmare for finding source of some syntax mistake in user code. Thanks. Dmitry. On Mon, May 26, 2014 at 12:24 PM, Andrea Faulds wrote: > > 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-lin= er > > (albeit a bit obscure) into a long multi-line all-caps gig. I=E2=80= =99ve 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=E2=80=99re 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=E2=80=99s still rather unwieldy, though. Maybe Z_PARAM could be shor= tened to > ZP_? Then we=E2=80=99d have this: > > ZEND_PARSE_PARAMETERS(ZP_ARRAY, input, ZP_LONG, offset, ZP_OPTIONAL, > ZP_ZVAL, z_length, ZP_BOOL, preserve_keys) > > That=E2=80=99s not so bad, right? That would be parsing at runtime instea= d 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=E2=80=99re only using C89, we can=E2=80=99t use a = nice > function-like macro syntax here. You=E2=80=99d also still need to explici= tly state > numbers of arguments. The first and second proposals are nice because the= y > 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/ > > > > > --089e01183d0a7051d804fa499147--