Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69231 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91992 invoked from network); 19 Sep 2013 10:48:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2013 10:48:51 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 157.55.2.27 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 157.55.2.27 dub0-omc3-s18.dub0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [157.55.2.27] ([157.55.2.27:26228] helo=dub0-omc3-s18.dub0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/30-24386-096DA325 for ; Thu, 19 Sep 2013 06:48:50 -0400 Received: from DUB403-EAS192 ([157.55.2.9]) by dub0-omc3-s18.dub0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 19 Sep 2013 03:48:45 -0700 X-TMN: [YD4kWZhBvXJWsbPcbAJRlXSwpmI8cuC8] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable References: <49D57F66323040FC9AE48244DAAF3771@gmail.com> <012B9378-3C3A-4169-96D3-3B57D6C7A82C@seancoates.com> MIME-Version: 1.0 (1.0) In-Reply-To: Date: Thu, 19 Sep 2013 12:48:41 +0200 To: Leigh CC: William Bartlett , Developers List PHP Mailing X-OriginalArrivalTime: 19 Sep 2013 10:48:45.0382 (UTC) FILETIME=[D052AE60:01CEB525] Subject: Re: [PHP-DEV] Re: Allowing is_* functions to accept multiple parameters From: bobwei9@hotmail.com (Bob Weinand) > Am 19.09.2013 um 11:10 schrieb "Leigh" : >=20 > On 19 September 2013 03:20, William Bartlett > wrote: >> I would argue that LTR support is also inconsistent / not desired. >>=20 >> If I wrote: >>=20 >> $i =3D 0; >> is_three($i =3D $i + 1, $i =3D $i + 1, $i =3D $i + 1); >>=20 >> I would certainly expect is_three to return false, but I would also expec= t >> $i to contain three. php doesn't normally evaluate arguments lazily, it >> would be weird for that behavior to suddenly crop up. users who want laz= y >> evaluation can write it the traditional way (with &&). >=20 > I think there has been some misunderstanding of my intention here > (maybe I communicated it badly) - Originally I was pretty confused > when reading Bobs response as it was way beyond the scope of what I > was proposing. >=20 > When I say parameters evaluated LTR / boolean short-curcuit evaluation > I mean it like this: >=20 > $i =3D 1; > $f =3D 1.1; >=20 > is_int($i, $f, $i, $i) =3D> is_int(1) && is_int(1.1) && is_int(1) && is_in= t(1) >=20 > is_int($i++, $f++, $i++, $i++) =3D> is_int(1) && is_int(1.1) && > is_int(2) && is_int(3) >=20 > $i =3D=3D 4; > $f =3D=3D 2.1; >=20 > Internally, processing will stop at the is_int(1.1) and not bother > continuing to check the types of further arguments. >=20 > I did not mean: >=20 > is_int($i++, $f++, $i++, $i++) =3D> is_int($i++) && is_int($f++) && > is_int($i++) && is_int($i++) >=20 > As Bob said, this would take some pretty nuts opcode processing, and > is completely not worth the effort involved. I may have emphasised a > parallel with isset() a bit too much, however isset() cannot take > expressions as input. >=20 > I was never intending to try and evaluate parameters as they were > passed and jump over subsequent evaluations. Standard function call > semantics would still apply. I hope that people find that less > confusing / unexpected. Well, then I misunderstood what you meant. Then the idea is acceptable. Not sure if we need this as it is very easily p= ossible with an one-liner in userspace code. I'm +- 0 on this. Bob Weinand=