Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47848 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55645 invoked from network); 9 Apr 2010 20:41:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Apr 2010 20:41:35 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 188.40.37.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 188.40.37.16 hq1.backendmedia.com Linux 2.6 Received: from [188.40.37.16] ([188.40.37.16:46061] helo=hq1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/95-54833-EF09FBB4 for ; Fri, 09 Apr 2010 16:41:34 -0400 Received: from localhost (unknown [127.0.0.1]) by hq1.backendmedia.com (Postfix) with ESMTP id D45A82E30008; Fri, 9 Apr 2010 20:41:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from hq1.backendmedia.com ([127.0.0.1]) by localhost (hq1.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oyMZClJfSU7v; Fri, 9 Apr 2010 22:41:29 +0200 (CEST) Received: from [192.168.0.151] (217-162-131-234.dclient.hispeed.ch [217.162.131.234]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by hq1.backendmedia.com (Postfix) with ESMTPSA id 0C21C2E30004; Fri, 9 Apr 2010 22:41:28 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Fri, 9 Apr 2010 22:41:29 +0200 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <981BD9EA-F604-4FB9-9D28-CBE7EC027566@pooteeweet.org> References: To: RQuadling@googlemail.com X-Mailer: Apple Mail (2.1078) Subject: Re: [PHP-DEV] Supplying nothing at all for default parameters From: mls@pooteeweet.org (Lukas Kahwe Smith) On 06.04.2010, at 12:16, Richard Quadling wrote: > Hello. >=20 > A suggestion I would like to make is to allow for nothing to be > supplied for defaulted parameters. >=20 > I suppose the easiest way of describing this issue is with the > following code ... >=20 > function foo($bar, $baz =3D 9, $buzz =3D 10) { > return "$bar $baz $buzz"; > } >=20 > // Whatever is supplied for $baz will be used for $baz. > // User has to know the default value of $baz rather than just > allowing the default value. > echo foo(1, 9, 20); >=20 > I don't know the stylics on using default parameters, but for the user > to have to know the default value would sort of make the default > redundant. >=20 >=20 > // Passing nothing at all could be one option. > echo foo(1, , 20); i dont think is really a nice syntax to support. either we add named = parameters are you just use the current work around for the absence of = named parameters (aka an array parameter and = array_merge/array_replace_recursive) regards, Lukas Kahwe Smith mls@pooteeweet.org