Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10729 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31808 invoked by uid 1010); 23 Jun 2004 16:01:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 31780 invoked from network); 23 Jun 2004 16:01:28 -0000 Received: from unknown (HELO xaxa.search.ch) (195.141.85.117) by pb1.pair.com with SMTP; 23 Jun 2004 16:01:28 -0000 Received: from localhost (localhost [127.0.0.1]) by xaxa.search.ch (Postfix) with ESMTP id 1440D6DB78; Wed, 23 Jun 2004 18:01:28 +0200 (CEST) Received: by xaxa.search.ch (Postfix, from userid 65534) id B26DA6D859; Wed, 23 Jun 2004 18:01:26 +0200 (CEST) Received: from cschneid.com (ultrafilter-i [192.168.85.2]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by xaxa.search.ch (Postfix) with ESMTP id 8149E6DB78; Wed, 23 Jun 2004 18:01:25 +0200 (CEST) Message-ID: <40D9A954.1040403@cschneid.com> Date: Wed, 23 Jun 2004 18:01:24 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040114 X-Accept-Language: en-us, en, de-ch MIME-Version: 1.0 To: Daniel Crookston Cc: internals@lists.php.net References: <20040623150429.E62456@hyperion-data.net> In-Reply-To: <20040623150429.E62456@hyperion-data.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on xaxa.search.ch X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Virus-Scanned: by AMaViS 0.3.12pre8 Subject: Re: keyword arguments? From: cschneid@cschneid.com (Christian Schneider) Daniel Crookston wrote: > some_function($a, 'B', :check TRUE) > > function some_function($first, $second, :check $key1 = FALSE, :foo $key2) First of all: I guess it is too early to start the discussion about named parameters again. As much as I think named parameters are an interesting concept I don't like this solution for its syntax and static semantics. If you are still interested in what solution we chose here then read below the line, otherwise please ignore the rest and don't flame me ;-) --------------------------------------------------------------------- I'm still in favor of an approach we are using here where you can pass associative arrays without array(): some_function($a, "B", 'check' => true); [ equivalent to some_function($a, "B", array('check' => true)); ] and use function some_function($first, $second, $param) { if ($param['check']) ... } [ or extract($more) inside some_function if you prefer that ]. Patches for php4 and php5 can be found at http://cschneid.com/php/php4/function_call_named_parameters.patch and http://cschneid.com/php/php5/function_call_named_parameters.patch respectively There is also a tool called convertsyntax.php at http://cschneid.com/php/ which converts between old and new syntax. Have fun, - Chris