Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68913 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28546 invoked from network); 6 Sep 2013 17:24:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2013 17:24:54 -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.223.169 as permitted sender) X-PHP-List-Original-Sender: admacedo@gmail.com X-Host-Fingerprint: 209.85.223.169 mail-ie0-f169.google.com Received: from [209.85.223.169] ([209.85.223.169:56252] helo=mail-ie0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B8/44-05619-5EF0A225 for ; Fri, 06 Sep 2013 13:24:54 -0400 Received: by mail-ie0-f169.google.com with SMTP id tp5so7685479ieb.28 for ; Fri, 06 Sep 2013 10:24:51 -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=hqbbht9RgMWOvJ7V/4PhvGo7FKYGrZfd5weBKUEP1+w=; b=wa+0kYqqR31pWpnaoMl9J38OvGvWq5wRsjMCtlu7eTJMaclXfSGnmELQ7POG9uBU1j QXsfF55VjQ0w3XS4JrypbDvidHiusgMQpXcKYsGGP64zh9PKEMMF22DgOBkUZkcMGjiD BfkXFK80lQQ503wJGDDlY9ZWcEjX2Ni0sRNpYr/NSgcI6VZMHi1xWv58KzV9Z14WLhrs Vv08pZxdqQonBU7bX34E2MLUzNVXRneY6lKn0h00nmj52O+tsj5Mv8NP3fHuGcrGgMQC ILr9PZe+QuozTq8Rx+D8jEADSfgRidnf6Cd2yxuUzSobPUlYts3zsufq6ZH54i7bEI6L zMew== X-Received: by 10.50.67.37 with SMTP id k5mr10857562igt.21.1378488291246; Fri, 06 Sep 2013 10:24:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.240.77 with HTTP; Fri, 6 Sep 2013 10:24:11 -0700 (PDT) In-Reply-To: References: Date: Fri, 6 Sep 2013 18:24:11 +0100 Message-ID: To: Pascal Chevrel Cc: PHP Internals , Nikita Popov Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: [RFC] Named parameters From: admacedo@gmail.com (Daniel Macedo) On Fri, Sep 6, 2013 at 6:01 PM, Pascal Chevrel wro= te: > Le 06/09/2013 18:39, Nikita Popov a =E9crit : > >> Hi internals! >> >> I created an RFC and preliminary implementation for named parameters: >> >> https://wiki.php.net/rfc/named_params >> >> The RFC and implementation are not yet complete. I mainly want to have >> feedback on the idea in general and on the Open Questions ( >> https://wiki.php.net/rfc/named_params#open_questions) in particular. >> >> Thanks, >> Nikita >> > > Hi Nikita, > > I love it and I love that it also applies to internal functions! > My preference for syntax would be this one: > > test($foo: "oof", $bar: "rab"); I agree that the : instead of =3D> would make it more readable and avoid confusion with array params in a fast/diagonal reading... However I am a bit averse to using $ for the keys, meaning for newer users this might become increasingly confusing: function fn($value1 =3D 20, $value2 =3D 1, $value3 =3D 3) { echo $value1 . $value2 . $value3; } $value1 =3D 20; $value3 =3D 9; fn($value1, $value3 =3D> 4); // Quick read expected 2019; got 2014! Hopefully this is a simple enough example to show the confusion that might arise. > > Using the $ sign means that it doesn't class with reserved keywords and t= hat > is consistent with the use of the dollar sign in PHP when we define the > functions. I prefer : to =3D> because it is a tad shorter and I think a b= it > more readable. > Indeed it's needed to avoid the reserved keywords issue... And I SINCERELY hope this RFC is accepted; but I am definitely worried what the syntax should be in order to improve readability, keep consistency within PHP, while avoiding confusion (mostly for new users, but also for the fast code read we usually make on a daily basis!) Perhaps the test($foo: "oof", $bar: "rab"); would be a more in line of what I think solves both issues (Niki, could you please add that one to the RFC?) > Thanks! > > Pascal > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Thanks