Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68869 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11821 invoked from network); 2 Sep 2013 21:43:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2013 21:43:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.48 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.48 mail-oa0-f48.google.com Received: from [209.85.219.48] ([209.85.219.48:65059] helo=mail-oa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B5/9F-29856-89605225 for ; Mon, 02 Sep 2013 17:43:53 -0400 Received: by mail-oa0-f48.google.com with SMTP id o17so5813604oag.35 for ; Mon, 02 Sep 2013 14:43:50 -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=+fmJGHEM9HYGiQ0w7uuA8Ov3SSJ4eyAI+m0XMj19Ur4=; b=rECLVFH49gOKCr3uh/jF7PM/tzGLLWokiQo6He40BmGMXYmiH2GXlFKg7l9pLKLVYS +O8gNyybtsDMTsRSMzwWSLVJIr6T32/vB88RgL5LcPfQbX2DXNptC6b40k5JD2EoPeuQ jx8wWLSbHGQFhG57cPLhBSHxmcpdZsym1Jul2hR6nucMrr4J2ae3YryYfVUZukBfuliF gPUcfZ6nqfhcgyAQMblgLjKOnrAB4XIRw0zG/caONbqm27NpipGRUDK41u46fTZOYJBk 5hjyBAt5b3Y/ASQIUB+HKpyTXpwuYbKjub/1pbrtsDo/DKf1BHzELY5arH6YXXtmkrPf UYBA== MIME-Version: 1.0 X-Received: by 10.60.62.101 with SMTP id x5mr18404904oer.24.1378158230488; Mon, 02 Sep 2013 14:43:50 -0700 (PDT) Received: by 10.182.98.8 with HTTP; Mon, 2 Sep 2013 14:43:50 -0700 (PDT) In-Reply-To: <5224F2EC.2090609@sugarcrm.com> References: <52243BA6.5040905@sugarcrm.com> <5224F2EC.2090609@sugarcrm.com> Date: Mon, 2 Sep 2013 23:43:50 +0200 Message-ID: To: Stas Malyshev Cc: Pierre Joye , PHP Internals Content-Type: multipart/alternative; boundary=089e012953acc5ccf804e56d77b4 Subject: Re: [PHP-DEV] [RFC] Skipping parameters take 2 From: nikita.ppv@gmail.com (Nikita Popov) --089e012953acc5ccf804e56d77b4 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Sep 2, 2013 at 10:19 PM, Stas Malyshev wrote: > Hi! > > > However I still wonder what prevents to finally implement named > > parameters too, it will provide the same feature while being even more > > For named params, you need to rewrite all args handling, since now it is > a positional array and that doesn't work with named args. On the way > you'd have to refactor zend_parse_parameters to understand named args > (which aren't even named in many internals, so you'd have to add those) > and deal with functions that use + and * in various creative ways and > see how those can be reconciled with named params. And then of course is > the question of by-ref parameters and how to make the syntax handle > those too. Long story short, you'll have to rewrite everything that does > with argument passing, argument receiving or even peeks into arguments. > I already have a mostly-working implementation for named arguments and unless I missed something critical it does not require us to redo argument passing. The idea I followed was to keep the argument passing pretty much as-is, just instead of always pushing on top of the stack to place named args directly at the correct offsets. So we still have a stack of positional arguments, they're just inserted out of order. This will also leave NULL values in between, so they need to be handled as in your implementation. The only thing you can't handle this way are named arguments that are not defined in the signature - if we want something like pythons **kwargs those need to be collected in an HT. I'd likely not support that at first, land basic named args instead and then seek to merge kwargs into the RFC's for variadics/unpacking. Nikita --089e012953acc5ccf804e56d77b4--