On 23 September 2016 23:14:37 BST, Dan Ackroyd wrote:
>On 23 September 2016 at 17:40, Rowan Collins
>wrote:
>>
>> I've been pondering an idea for ages of a generalised syntax for
>switch to
>> specify an operator to use, so you'd do something like this:
>
>That's technically possible already:
>
>
On 23 September 2016 at 17:40, Rowan Collins wrote:
>
> I've been pondering an idea for ages of a generalised syntax for switch to
> specify an operator to use, so you'd do something like this:
That's technically possible already:
function foobar($foo)
{
switch (true) {
case $foo ===
On 23/09/2016 16:59, Stephen Reay wrote:
I would however love a way to have strict comparisons in a switch statement.
I've been pondering an idea for ages of a generalised syntax for switch
to specify an operator to use, so you'd do something like this:
switch ( $foo ) use ( === ) {
case
I find the idea of making ‘==‘ which has always been a loose comparison, have a
new optional way to be ‘more strict’ than ‘===‘ to be quite odd.
I would however love a way to have strict comparisons in a switch statement.
Cheers
Stephen
> On 23 Sep 2016, at 20:51, Christian Schneider wrote
Am 19.09.2016 um 15:04 schrieb Vesa Kaihlavirta :
>
> $two = "2";
> if ($two > 1) {
>echo "This sorta works without strict_comparisons=1" . PHP_EOL;
> }
>
> ...would throw a TypeError exception after this change.
This sounds like a bad idea to me: Changing the language semantics of some
> What still worries me personally is ===. What do you think would be the
> least incorrect way to handle ===
> 2) === is not affected by strict_comparisons.
I think not changing it is the correct thing to do.but I think it
needs more thinking about.
Btw, the RFC would need to cover all cases
Am 21.09.16 um 14:49 schrieb Vesa Kaihlavirta:
On Tue, 20 Sep 2016 at 02:20 Dan Ackroyd wrote:
Hi Vesa,
On 19 September 2016 at 14:04, Vesa Kaihlavirta
wrote:
My idea is to add a strict_comparisons declaration that you can add at
the
beginning of a file in the same way as strict_types.
P
On Tue, 20 Sep 2016 at 02:20 Dan Ackroyd wrote:
> Hi Vesa,
>
> On 19 September 2016 at 14:04, Vesa Kaihlavirta
> wrote:
> >
> > My idea is to add a strict_comparisons declaration that you can add at
> the
> > beginning of a file in the same way as strict_types.
> >
> > Please take a look and let
On 19 September 2016 14:04:48 BST, Vesa Kaihlavirta wrote:
>My idea is to add a strict_comparisons declaration that you can add at
>the
>beginning of a file in the same way as strict_types. The effect would
>be
>that all normal comparisons would make a type check before doing the
>actual
>comparis
Hi Vesa,
On 19 September 2016 at 14:04, Vesa Kaihlavirta wrote:
>
> My idea is to add a strict_comparisons declaration that you can add at the
> beginning of a file in the same way as strict_types.
>
> Please take a look and let me know if this would be worth a more official
> RFC.
I think it de
Hey all,
I've been bouncing this idea of fixing all comparison operations in one
fell swoop, although with an opt-in declare in the spirit of strict_types.
Here's the gist: ==, < and > plus all the comparisons done inside switch
statements and arrays are not very safe. === helps some, but does no
11 matches
Mail list logo