Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60175 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32096 invoked from network); 18 Apr 2012 09:26:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2012 09:26:04 -0000 Authentication-Results: pb1.pair.com header.from=admacedo@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=admacedo@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: admacedo@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:45991] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/55-03614-BA88E8F4 for ; Wed, 18 Apr 2012 05:26:04 -0400 Received: by yhfq11 with SMTP id q11so3965086yhf.29 for ; Wed, 18 Apr 2012 02:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=cm1aP5KJZYKCbhxRizth3Ecmfbc6P3nHhG2RtMmQwp8=; b=bWyOdA8hE9W1nVmiaNzUoxO+6/xQuLOjtCcou/w/vz/irYBqRwObHVfkj06sakFcVC 9/kMSsopJQZ65+eaPwVbhVQjxOk9qV3x0yq+UoF/LUX/KULnfpvU7SeSLMjMlurGwSL9 KHxSv4DBgU1P0ukvjxCAZw3U/WaPsVy9GcSOvJf0ITMza9nf8gEcL7dBnceZ2tmLsb6p nJjPwcHrjPspzpfqPQJN477sl3vCAJ8cy9UNH38f+d2dQAQwO2DMiPG4ssAL4nzCLTe3 XyEVeKh6zKLeGeFb1Qbd39y643NSZsQN+wkczNzPa8CEHA13O+9vsuqj9nfi0Ea7W2l7 AGLg== Received: by 10.236.173.168 with SMTP id v28mr1390434yhl.42.1334741160683; Wed, 18 Apr 2012 02:26:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.46.130 with HTTP; Wed, 18 Apr 2012 02:25:19 -0700 (PDT) In-Reply-To: References: <4F8DF4B1.2040307@sugarcrm.com> Date: Wed, 18 Apr 2012 10:25:19 +0100 Message-ID: To: Adam Jon Richardson Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] skipping optional parameters From: admacedo@gmail.com (Daniel Macedo) I'll keep going offtopic a bit more. I would rather see named parameters implemented *prior* to this. Although maybe not instead, I think both might have their place. On Wed, Apr 18, 2012 at 08:43, Yasuo Ohgaki wrote: > > Something like > > setcookie( name:'mycookie', value:'abc', secure:true, httponly:true ); > > is really nice to have. Source code will be much more readable. > I agree with this!=A0But for short array syntax we kept the =3D>=A0as in $array =3D ["foo" =3D> "bar"]; Not sure if this was a limitation, lack of that suggestion or a decision; but the shortest syntax it's still not... (as Yoda would say!) $array =3D ["foo": "bar"]; doesn't look weird to me, plenty readable, and that's the shortest! > This is getting off-topic, but while we're here, I think: > > setcookie($name =3D> 'mycookie', $value =3D> 'abc'); Not sure what the optimal PHP syntax should be for named parameters, but I think this isn't it. Back to the topic at hand. There doesn't need to be a lot of parameters on a function for this to be useful, even with IDE assistance. For a proper refactoring, where you'd only needing to change the function definition. In calls where the optional parameters would call a 'default', they should in fact be the default. Where as now we'd have to go through all the function calls for any case where we statically used the default and change it to the new default... But I couldn't support the comma train, for the insane =ABlots of parameters=BB case, would hate to read some fn($some,,,, $var,,, $other) call. I'd rather reuse a reserved word like 'default' (or even get a shorter one?= )