Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85530 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56837 invoked from network); 29 Mar 2015 17:32:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2015 17:32:39 -0000 Authentication-Results: pb1.pair.com header.from=gm@gm.lv; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=gm@gm.lv; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gm.lv designates 188.226.183.209 as permitted sender) X-PHP-List-Original-Sender: gm@gm.lv X-Host-Fingerprint: 188.226.183.209 unknown Received: from [188.226.183.209] ([188.226.183.209:43520] helo=smtp.gm.lv) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/10-55502-63738155 for ; Sun, 29 Mar 2015 12:32:39 -0500 Received: from [1.1.1.15] (unknown [84.237.185.4]) by smtp.gm.lv (Postfix) with ESMTPSA id E1CB24099C; Sun, 29 Mar 2015 17:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=gm.lv; s=mail; t=1427650355; bh=tT/P+hGR+Naqnnj+7joNYEeBGIogyKxtEua4NTM6t04=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=KBrTSsu1eFv+jSdxVOK0xVQs1kJ0V2MYRVU/Tsdt2uwhWoh9E6ewgHXgKbD+wNhr7 4/Y4UPrXVN/54lFJhFgnI3EBDAb3yCujnVm3GOl3FGSStNk38Bv3NjyljQvvCdpneh TTBuKcShfKl1kEn0SNKLwKeDCuPTL7rxcdX1rhzA= Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Sun, 29 Mar 2015 20:32:35 +0300 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <053AD827-F377-4BD2-92FA-FE06D04EC580@gm.lv> References: <76D3DA4F-06EE-4F6B-893E-1D111FAD3C2C@gm.lv> To: Dan Ackroyd X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [RFC] Named parameters From: gm@gm.lv (Gints Murans) > On 29 Mar 2015, at 17:56, Dan Ackroyd wrote: >=20 > On 29 March 2015 at 12:28, Gints Murans wrote: >=20 >> What happened to this RFC? This is a really great idea for php. >=20 > The 'Skip Params' RFC (https://wiki.php.net/rfc/skipparams) went to > vote and was declined. "Named params" sounds a lot better idea instead of "Skip Params". I = would also vote "no" for the later one. > The 'named params' RFC (https://wiki.php.net/rfc/named_params) author > has been working on stuff they feel is more important. Sad. :( I don't know C that well to be able to help out. >> Reading over some old code, this way it would be a lot easier to = understand what that second parameter boolean =3D true is: >=20 > You can do this right now, if you want to: >=20 > getIdByTitle('sample', $insert =3D true); This is fundamentally wrong, this way a local variable is created and is = really not a solution for named parameters,=20 and parameter skipping, just a workaround to fool my self. :) >> About syntax: $insert =3D> true seems kind of confusing: >> $insert =3D true; >> getIdByTitle('sample', $insert =3D> $insert) >=20 > You shouldn't need it for the case where you're actually already using > a parameter e.g. `getIdByTitle('sample', $insert);` already indicates > what the parameter is. The only place where you could argue this > syntax is needed is when you're passing in just a bare 'true' which > has no syntactic meaning associated with it. That was only one example, how about: `getIdByTitle('sample', $insert =3D>= empty($somethingElse));`,=20 its still confusing and for newcomers would be hard to understand, = because $insert isn't a variable, but the function's parameter.=20 Unless we look at it like we are setting function's parameters as = variables, but then it shouldn't have array element assignment operator = (=3D>). Although `getIdByTitle('sample', $insert =3D true);` would most probably = conflict with variable assignment functionality, i.e. create local = variables, which shouldn't happen in case of named parameters.=20 Anyway my preference would be `getIdByTitle('sample', insert: true, = type: 'x', description: 'Something');` >=20 > That syntax works for all versions of PHP, so I guess a new syntax > that achieves the same thing is unlikely to be that popular an idea. Well thanks for pointing it out, but this is really a good feature and I = hope i will be accepted sooner than later. >=20 > cheers > Dan