Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62503 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37859 invoked from network); 25 Aug 2012 23:57:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Aug 2012 23:57:08 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:65164] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/F7-06857-45669305 for ; Sat, 25 Aug 2012 19:57:08 -0400 Received: by pbbrp8 with SMTP id rp8so5437714pbb.29 for ; Sat, 25 Aug 2012 16:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=XodvQPtd4MdXmcmgi4Rmi3Q/Jeb3UZyzzrollahkKTc=; b=jfOjNzkhhGwp/UAeC36WGD325QoLQoijUE5/x7cRB5GmlzOuKEwuRiSR62Xvgy/q7G khGvua9gIfjZkrmSp65wrttGRmMjZBGiobZIfNGofseGTp+/rU5bnk2/XcVzq9UDbFDA NKaoE0Z2f8WmbV6vCq+5qzmGRFxAtXNrUXmpnT671QYNj1lFeWkcl+LX0NWpGcIBdPLy 35SzkBTAgYTrpYJu/hhOXn0QGiKbpLxqCoEmCFE6lyYbtPDz2LrWn+EV/4MCQF3kEhz9 wypZ7tNdiPtZYy9R1NakL+oCbanfD/AC/ALeiT3GIMAxcY7RMkwVz+BLaGHLeNxEmicR QuTw== MIME-Version: 1.0 Received: by 10.66.75.225 with SMTP id f1mr20196749paw.35.1345939025534; Sat, 25 Aug 2012 16:57:05 -0700 (PDT) Received: by 10.68.211.37 with HTTP; Sat, 25 Aug 2012 16:57:05 -0700 (PDT) In-Reply-To: References: <502EBAA4.9090007@gmail.com> <50381196.4090606@gmail.com> <5039102F.5010305@gmail.com> Date: Sun, 26 Aug 2012 01:57:05 +0200 Message-ID: To: David Muir Cc: Sebastian Krebs , PHP internals list Content-Type: multipart/alternative; boundary=f46d042dfd6b819f1104c81fd930 Subject: Re: [PHP-DEV] Combined assignment operator for short ternary From: tyra3l@gmail.com (Ferenc Kovacs) --f46d042dfd6b819f1104c81fd930 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > > > So you are saying that your (teams) IDE doesn't tell you the method > > signature which contains also the default values? > > I guess that the fact that many of the php core functions have optional > > arguments and non null defaults must be really a PITA for you. > > I think what he was alluding to is the problem where one changes the > default. All usages of the method/function then need to be updated. Using null today > is very much like using the proposed 'default' parameter skipping RFC. > true, using null as a default value for your optional arguments means that you don't really need the parameter skipping RFC (at least for the functions that you control) or the named params, because you can pass null for the in-between optional arguments. ofc. most modern IDEs also have some kind of refactoring feature, which would make it easier for you to update the function calls to reflect the change in the default value, but it would be harder to tell the original intention ($limit is 30 here, because it was the default and the caller wanted to set the next optional argument, or $limit is intentionally set to 30 and the next optional argument also happen to be needed). thanks for clearing that one up for me. Having every optional argument defaulting to null means that it can be frequent scenario, when you have a variable, which is guaranteed to be defined, but can be null. But I still think that it isn't that frequent that you want to keep the non falsely values or set a default value otherwise. I mean if you expect a number, then you don't want your passed 0 to be replaced with the default, or if you expect a string, you don't want "0" or maybe even "" to be replaced with the default, etc.. So you couldn't use the ternary assignment for those scenarios. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --f46d042dfd6b819f1104c81fd930--