Re: [RFC] Interval Comparison
| From: | Fleshgrinder | Date: | Fri, 11 Nov 2016 18:25:01 +0000 |
| Subject: | Re: [RFC] Interval Comparison | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96836@lists.php.net to get a copy of this message | ||
On 11/11/2016 6:03 PM, David Walker wrote:
> I took a quick stab at implementing, and had something working for constant
> expressions, but handling something akin to:
>
> $a = 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==3) < 3).
>
> Just some food for thought
> --
> Dave
>
Nice :)
Personally I would make all of these situations parse errors. These are
hard to read and understand code constructs, why would we want to
support them in the first place?
--
Richard "Fleshgrinder" Fussenegger