Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96857 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13608 invoked from network); 12 Nov 2016 16:21:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2016 16:21:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=dave@mudsite.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dave+php@mudsite.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mudsite.com designates 209.85.217.181 as permitted sender) X-PHP-List-Original-Sender: dave@mudsite.com X-Host-Fingerprint: 209.85.217.181 mail-ua0-f181.google.com Received: from [209.85.217.181] ([209.85.217.181:35821] helo=mail-ua0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/B0-05927-99147285 for ; Sat, 12 Nov 2016 11:21:46 -0500 Received: by mail-ua0-f181.google.com with SMTP id 12so35142229uas.2 for ; Sat, 12 Nov 2016 08:21:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mudsite-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cUhGzKJhZqzjBp9B/7f0jlHFybJYRZFbxGFIzCbdLeU=; b=0L5Q4l1f/ViJEGwjIkYTSLn9+/9IlswgTFMKbp7a1f3xt8uUgo4ifuLbdGCFENZm6X rlokatgnjdy2DSZiSz4onYpetViwhfLYKcU0mDLMuMRA6CS1jDJJgdqnrTa4pYooVnYH 89b/6MOjANEz5PxDQ214UQuwfnp7KAxe2sPKxD7d6HBvKOF7z3vjESUOHn9XZqiR1e/H GVIE2W4yYCbA3HN3iDcOC7MeyiLrzqysXMMH5TVAuPhXgaFruhbQGiARk4nzrifhrvkJ nPju5pX+7DHbuRso2vh0I+5tl6Cw0Z1TZH3ILf0Y1561WuPEwxVnskwEdrmmGf7t8tHa eVSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cUhGzKJhZqzjBp9B/7f0jlHFybJYRZFbxGFIzCbdLeU=; b=KmBZB2D0hakSVr7KuR+HKaScYN41MhVwKV+5rmWjoNBAgNHAi/B9xsufLyUxVhJG+S xYvAr6qzxsLZl4W4GAx4PpnK7M3b7BjebW22S+1xT5HsLD9j/u24815GvJqeBqhKviUG PAf84qVU/2Hah37rZ8GYDH5xeQKPIexmSbIfWISAG3kJmM2SSn1Nmv+aND9M5hRTWDPO tMZuppIEnXgBCU0yt/KQ/ZoCwFg+ZYKwkrQX/llVU8Jk+YTVvI3D/Jh57ShOvp2khwrq lY8MPHdALM1JAXpucZLLIGi7RS4fOMlc0J5UXCxu+czVtIpyp/g3x0YWZxycWb8dV2re QCMg== X-Gm-Message-State: ABUngvdej7EY+tnlN3dIWkMKwnqBEXKoFzcnSycPmE3W/RIjDBV+i922gpcz6uEAfS8zBIS9kDXXioZQaNUWTg== X-Received: by 10.176.69.230 with SMTP id u93mr5449008uau.158.1478967703169; Sat, 12 Nov 2016 08:21:43 -0800 (PST) MIME-Version: 1.0 References: <3e3180e8-e9c2-abca-5228-221f8eae713d@fleshgrinder.com> <9a84054848086fa4c2965f93dd3b56a3@gmail.com> In-Reply-To: <9a84054848086fa4c2965f93dd3b56a3@gmail.com> Date: Sat, 12 Nov 2016 16:21:32 +0000 Message-ID: To: =?UTF-8?Q?Lauri_Kentt=C3=A4?= Cc: internals@lists.php.net, Andrea Faulds Content-Type: multipart/alternative; boundary=94eb2c11c9e895031605411d00ee Subject: Re: [PHP-DEV] [RFC] Interval Comparison From: dave+php@mudsite.com (David Walker) --94eb2c11c9e895031605411d00ee Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Nov 12, 2016 at 3:08 AM Lauri Kentt=C3=A4 = wrote: > On 2016-11-11 19:03, David Walker wrote: > > > > I took a quick stab at implementing, and had something working for > > constant expressions, but handling something akin to: > > > > $a =3D 2; > > if (1 < $a++ < 3) { > > ... > > } > > > > Is a bit awkward in our expansions of : if (1 < $a++ && $a++ < 3). > > Seems as if when processing the chain here, you'd need to see if the > > left node has a child, and somehow ensure you get the evaluated value > > somehow, to override the "left" node. So logically expansion of the > > above would be if (1 < $a++ && 3 < 3). I think the same would have > > too somehow handle (either by syntax error or something) that if a > > non-numeric value creeps into a binary-op-compare we error like: if > > (1 < (2=3D=3D3) < 3). > > > > Just some food for thought > > -- > > Dave > > I don't see how you would =E2=80=9Dlogically=E2=80=9D get 3 < 3. The very= point of > chaining is that each expression is evaluated only once, so the > expression will have the same value in both of the comparisons. So if > the first part is 1<2, then the other must be 2<3 (and not 3<3). > > An expression like a < b < c < d can be currently implemented with > temporary variables like this: > a < ($tmp1 =3D b) && $tmp1 < ($tmp2 =3D c) && $tmp2 < d > That's was the intent in the question I tried to raise with the post-increment, as you write `$tmp1 =3D b`, to my example `$tmp1 =3D $a++`: Should $a =3D 1; var_dump(1 < $a++ < 3); (expanded into numbers) be evaluated as: 1 < 2 && 2 < 3 - True or 1 < 2 && 3 < 3 - False I could see the case for either, although, I would probably prefer the latter, as that's what's apparent today, example with ``` $a =3D 0; var_dump($a < 1); var_dump(++$a < 1); ``` Would print out true, false. Sorry I wasn't overly clear in my statement. -- Dave --94eb2c11c9e895031605411d00ee--