Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18007 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85487 invoked by uid 1010); 13 Aug 2005 23:42:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85472 invoked from network); 13 Aug 2005 23:42:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2005 23:42:10 -0000 X-Host-Fingerprint: 195.226.6.9 darkcity.gna.ch Linux 2.4/2.6 Received: from ([195.226.6.9:38181] helo=darkcity.gna.ch) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 03/61-33075-1558EF24 for ; Sat, 13 Aug 2005 19:42:09 -0400 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id C443C1D15B6; Sun, 14 Aug 2005 01:42:05 +0200 (CEST) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXna0PaK; Sun, 14 Aug 2005 01:42:04 +0200 (CEST) Received: by darkcity.gna.ch (Postfix, from userid 65534) id 7469C1D15B7; Sun, 14 Aug 2005 01:42:03 +0200 (CEST) Received: from [192.168.1.43] (80-219-12-45.dclient.hispeed.ch [80.219.12.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTP id 40D231D15B4; Sun, 14 Aug 2005 01:41:57 +0200 (CEST) Message-ID: <42FE85AA.6020309@cschneid.com> Date: Sun, 14 Aug 2005 01:43:38 +0200 User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: George Schlossnagle Cc: internals@lists.php.net References: <42FCE0E4.604@lerdorf.com> <42FDDF11.2050308@cschneid.com> <6E8568FA-5893-476A-A88F-E5504C638F37@omniti.com> In-Reply-To: <6E8568FA-5893-476A-A88F-E5504C638F37@omniti.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on darkcity.gna.ch X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=AWL,RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=disabled version=3.0.4 X-Virus-Scanned: by amavisd-new at gna.ch Subject: Re: [PHP-DEV] Re: PHP 6.0 Wishlist From: cschneid@cschneid.com (Christian Schneider) George Schlossnagle wrote: > Huh? Perl doesn't have true support for this anyway, just a simpler > syntax for hashrefs. If you want Perlish named params this is 100% > identical to doing > foo(array('id' => 42, 'name' => 'foo')); If you are using this a lot then syntactic sugar does make a difference IMHO. That's why we decided to use a patch to allow foo('id' => 42, 'name' => "foo"); I agree that a fancier way would be to have something like function foo($id = 42) { ... } ... foo(id: 64738, name: "foo"); and then access them through $_PARAM['id'] (or $id because the function definition declares $id) and $PARAM['name'] respectively. What I don't like about Python at all is that AFAIK you can't call a method with parameters not declared in the function definition. That's a very handy feature for things like DB actions or HTML generation. Missing from the fancier version: Parameter names which aren't valid identifiers and preparing an array with values before calling a function. The first is a more hypothetical limitation as fields/attributes are normally not containing non-identifier characters but the second is a bit more practical: $record->insert('id' => 42, 'name' => "foo"); works just as well as $tags = array('id' => 42, 'name' => "foo"); ... # Add more key/values to $tags $record->insert($tags); without requiring insert() to distinguish between the two. If someone can come up with an elegant way to populate $_PARAM on a function call then both these limitations would be gone. That's it about named parameters from my side for now, - Chris