Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80204 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77861 invoked from network); 5 Jan 2015 22:15:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jan 2015 22:15:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:45921] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/DA-21693-5FC0BA45 for ; Mon, 05 Jan 2015 17:15:18 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 61361B000A3; Mon, 5 Jan 2015 17:15:14 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sk1d7oZKDHEC; Mon, 5 Jan 2015 17:15:14 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 7B800B000A2; Mon, 5 Jan 2015 17:15:13 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: <54AB0A10.4010709@gmail.com> Date: Mon, 5 Jan 2015 22:15:11 +0000 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <54AB0A10.4010709@gmail.com> To: Stanislav Malyshev X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Parameter skipping, take 3 From: ajf@ajf.me (Andrea Faulds) Hi Stas, > On 5 Jan 2015, at 22:02, Stanislav Malyshev = wrote: >=20 > For those who doesn't remember, quick reminder - it is about an = ability > to skip parameters in function calls so they'd take default value, = like > this: > function foo($a, $b =3D true, $c =3D "abc") { ... } > foo($x, default, $y); // $b gets to be true here >=20 > In the last discussion I had a lot of "objections" to the tune of = "we'd > rather have named parameters". I like the idea of named parameters = too, > but this one does not contradict it - rather, it compliments it, and a > lot of the extensions cleanup done in this patch also serves as a base > for possible implementation of named params, if it happens (more on = that > in the RFC itself). Yes, they complement one another. Both exist because of horrible APIs. = But I don=E2=80=99t think we should encourage horrible APIs. I don=E2=80=99t want to end up with the Windows API, except in PHP = style: CreateWindowEx($foo, default, default, $bar, 0, 0, 100, 100, default, = default, default, default); For well-designed functions, there is no need to skip parameters, either = with a default keyword or with named parameters. So it=E2=80=99s a firm -1 from me. The solution to horrid APIs isn=E2=80=99= t to add kludges to the language that make them slightly less painful. = The solution is to fix them, or add new APIs, that are well designed. Thanks! -- Andrea Faulds http://ajf.me/