Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47778 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29305 invoked from network); 4 Apr 2010 22:45:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2010 22:45:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-wy0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:50030] helo=mail-wy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/40-41826-F7619BB4 for ; Sun, 04 Apr 2010 18:45:19 -0400 Received: by wyb34 with SMTP id 34so1467072wyb.29 for ; Sun, 04 Apr 2010 15:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type; bh=jZ7s6CZf+7w2c6O9Q8ICm0Css232rwt3zIveSOcTfqg=; b=bIaYCAsA3Noucx2pt9QZiQ+16XWEztdk7Zb3Rl4T8GqtR6Iv8iGqMejuYT6iAwoxcK 12LVSXi7Hm7xWDV7xnPpzk6qwQphqvu78svtL048VsTyPZfTK0xorYN7/B50Brd0+qBx yumfpriJV5uku2jKJDrGtsUByUNlV7m97G3D4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=k3NiL9/A/Z/OoE7cfLSHtXzZVx1cZHQ0XDndpRtplnUnv9Kbtpj+tMIZ3nhj8YVoAk IWjGbSd4TAaZuq8cTjZW9Gb+CQlaJy8vJEmbSwiRRgg/o+JoJEfnqKe57TZ+zgJqwo2b doFEqWViruLtWdOt3mg12SGT9v2KKxOClila8= MIME-Version: 1.0 Received: by 10.216.185.140 with HTTP; Sun, 4 Apr 2010 15:45:16 -0700 (PDT) In-Reply-To: <4BB90DB7.6060706@zend.com> References: <745C5243-EB51-4D43-B036-8A34CDBBB547@gregory.net> <4BB68D61.2070301@lerdorf.com> <4BB6938F.7090404@zend.com> <4BB90DB7.6060706@zend.com> Date: Mon, 5 Apr 2010 00:45:16 +0200 Received: by 10.216.86.208 with SMTP id w58mr2387845wee.45.1270421116376; Sun, 04 Apr 2010 15:45:16 -0700 (PDT) Message-ID: To: Stanislav Malyshev Cc: Hannes Magnusson , GM , internals@lists.php.net, Rasmus Lerdorf Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Named Parameters From: pierre.php@gmail.com (Pierre Joye) hi, On Mon, Apr 5, 2010 at 12:07 AM, Stanislav Malyshev wrote: > 3. Combining named and un-named params can get weird - i.e. foo(1,2,3) is > simple, foo(1, 2, bar => 3) is doable, but foo(1, 2, bar => 3, 4) would be > trouble, since it is not clear at all where 4 should go to. Moreover, > catching this situation can be non-trivial, as right now parsing nested > function calls may not keep enough context for this. If we introduce named argument, mixing them should not be weird. An argument can have both a name and a position, allowing combination of normal or named arguments. Python's way to do it is very nice and handy: http://diveintopython.org/power_of_introspection/optional_arguments.html I did not look at the parser implementation or limitation lately, but it would rock if we can use the same syntax than python. It should not conflict with any existing syntax (foo($a = 1) already works, with operator precedence). Again, if the parser allows it :) I also don't see another way to do it than using a hash (or similar constructs) which will certainly have a significant impact on performance. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org