Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68979 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99052 invoked from network); 9 Sep 2013 19:57:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2013 19:57:59 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.173 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.173 mail-ob0-f173.google.com Received: from [209.85.214.173] ([209.85.214.173:51683] helo=mail-ob0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/5D-03199-6482E225 for ; Mon, 09 Sep 2013 15:57:58 -0400 Received: by mail-ob0-f173.google.com with SMTP id ta17so6272529obb.4 for ; Mon, 09 Sep 2013 12:57:55 -0700 (PDT) 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=rE7X1wZ/kgx0CWmsR0V+LmF9qD75yPQQ/NzOcxLzLpw=; b=U5X6WJ6sPK+njPjykDfjgCwrROaYWnbmxH+tC4CQdl/24MHEmd9FsnKBqEXrij2i08 U9gIenC0J2OfovBcnQFvbtamY39alTgDM8GLjr92g5IJycxeMk33LumwNVSPh8vFigNU 97zbtsP4A19xbzpTWOqy9wizVPAM/ndr/buJa77f2wmr9rDV8R+0hKDGZtzTWuuTyLUn xw78cV0IOM/508nUS8KzOzJNYXxxeQRmkfDFPMNNwVYWEzYfjglnH5VhCWlac7DWUPqj wWIQmeZ4DWuy7N+fBiu1b/1tL/RoJSIfivVVVW3luyh3ttJWU0R/nz48pq1mHbnZnZ70 x+9w== MIME-Version: 1.0 X-Received: by 10.60.70.134 with SMTP id m6mr12333124oeu.14.1378756675856; Mon, 09 Sep 2013 12:57:55 -0700 (PDT) Received: by 10.182.98.8 with HTTP; Mon, 9 Sep 2013 12:57:55 -0700 (PDT) In-Reply-To: References: Date: Mon, 9 Sep 2013 21:57:55 +0200 Message-ID: To: Pierre Joye Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1133458ee5705b04e5f8cde4 Subject: Re: [PHP-DEV] [RFC] Named parameters From: nikita.ppv@gmail.com (Nikita Popov) --001a1133458ee5705b04e5f8cde4 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Sep 7, 2013 at 9:52 AM, Pierre Joye wrote: > In no particular order: > > . Warning: Cannot pass positional arguments after named arguments. > Aborting argument unpacking in %s on line %d > > Would it make more sense to make it a fatal error? As the code will > likely not work as expected, at all. It could be a bit too harsh but > as it is a new feature, there is no BC impact and ensure good usage. > I agree that continuing the function call in that case is a bad idea, but I also really dislike throwing fatal errors when dynamic constructors are used. An exception would be optimal here (no continued function call, but easily recoverable), but I know I'm not allowed to introduce those... > . would it make sense to have an alternative zend API to fetch one or > more argument using its name? I can see a couple of usages for such a > function > I provide this function: ZEND_API int zend_get_arg_num(zend_uint *arg_num_target, zend_function *fn, char *name, int name_len, zend_ulong hash_value TSRMLS_DC); Using it you can get the argument number from a parameter name and based on that lookup the value of the argument as usual. Is that sufficient? > - It would be nice to add (later once the RFC is more stable) docs > about which impacts and changes are expected for extension developers > Yes, sure :) - Do you have a fork for this RFC? Much easier to test, create snaps, etc. > Yes, it's the namedParams branch of my github fork: https://github.com/nikic/php-src/tree/namedParams Nikita --001a1133458ee5705b04e5f8cde4--