Re: [PHP-DEV] [RFC] [Discussion] JSON_THROW_ON_ERROR

2017-09-10 Thread Bradley Weston
I definitely hate having to test the return value and then getting the error message via a function call. +1 for ability to throw exceptions instead. On 10/09/17 02:24, Andrea Faulds wrote: Hi everyone, Craig Duncan previously sparked discussion here about JSON's error-handling behaviour. U

[PHP-DEV] Re: [RFC] Match expression

2017-09-10 Thread Tony Marston
wrote in message news:eb28362c-4f8f-45df-bbf0-582e8ad2b8af@Spark... Hi everybody! Has this idea been discussed before? I find myself writing switch statements in PHP quite rarely. This has a few reasons: 1. It doesn’t have a "strict_types” version 2. It is quite verbose (lots of breaks) 3.

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-10 Thread ilija . tovilo
Hi Tony > … you sometimes forget to insert a break statement then that is your fault. Any bug in your source code is ultimately your fault. But as mentioned before human error is inevitable. You can make it easier for your users to make less mistakes though. Other languages (e.g. Rust or Swift)

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-10 Thread Tony Marston
wrote in message news:7cd2884a-6606-4c3f-8f95-776fd277878b@Spark... Hi Tony … you sometimes forget to insert a break statement then that is your fault. Any bug in your source code is ultimately your fault. But as mentioned before human error is inevitable. You can make it easier for your us

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-10 Thread ilija . tovilo
> it makes it impossible to group several conditions with a single break In Swift you can group multiple conditions with a comma `,` and in Rust with a pipe `|`. Here’s how that could look in PHP: ```php match ($x) {     1, 2: ‘One or two’; } ``` The only thing you cannot do is this: ```php sw

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-10 Thread Tony Marston
wrote in message news:3b05768a-95b7-42de-8bb8-3d9ce0cce3a5@Spark... it makes it impossible to group several conditions with a single break In Swift you can group multiple conditions with a comma `,` and in Rust with a pipe `|`. Here’s how that could look in PHP: ```php match ($x) { 1, 2

Re: [PHP-DEV] Re: [RFC] Match expression

2017-09-10 Thread Dan Ackroyd
On 10 September 2017 at 12:09, Tony Marston wrote: > > So why are you proposing a third alternative to the switch of if/elseif > statements? Because they think it's a good idea. Not everyone is going to agree, which is why we have voting for RFCs. cheers Dan Ack -- PHP Internals - PHP Runtim

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Rowan Collins
On 09/09/2017 12:21, ilija.tov...@me.com wrote: Hi everybody! Has this idea been discussed before? I find myself writing switch statements in PHP quite rarely. This has a few reasons: 1. It doesn’t have a "strict_types” version 2. It is quite verbose (lots of breaks) 3. It is a statement rath

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Theodore Brown
On Saturday, September 9, 2017 6:21 AM, ilija.tov...@me.com wrote: > I find myself writing switch statements in PHP quite rarely. This has a few > reasons: > 1. It doesn’t have a "strict_types” version > ... > I assume that some people will not be so happy about having to switch-like > construct

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Niklas Keller
2017-09-10 18:05 GMT+02:00 Theodore Brown : > On Saturday, September 9, 2017 6:21 AM, ilija.tov...@me.com wrote: > > > I find myself writing switch statements in PHP quite rarely. This has a > few reasons: > > 1. It doesn’t have a "strict_types” version > > ... > > I assume that some people will n

[PHP-DEV] Wiki karma request

2017-09-10 Thread Larry Garfield
Username: crell Access requested: Wiki edit Reason: Helping out Sara Golemon with logistics and paperwork for the short-lambda RFC, and collaborating on another RFC regarding comprehensions. Please! --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visi

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Rowan Collins
On 10/09/2017 17:27, Niklas Keller wrote: 2017-09-10 18:05 GMT+02:00 Theodore Brown : Would it be possible to add an optional `$strict` parameter to switch? E.g. ``` switch ($i, true) { I'd very much prefer a "strict switch ($i) { ... }" over a second parameter. What do either of you think

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Theodore Brown
On Sunday, September 10, 2017 12:45 PM Rowan Collins wrote: >>> Would it be possible to add an optional `$strict` parameter to >>> switch? E.g. >>> ``` >>> switch ($i, true) { >> >> I'd very much prefer a "strict switch ($i) { ... }" over a second parameter. > > What do either of you think of my

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread li...@rhsoft.net
Am 10.09.2017 um 21:16 schrieb Theodore Brown: On Sunday, September 10, 2017 12:45 PM Rowan Collins wrote: Would it be possible to add an optional `$strict` parameter to switch? E.g. ``` switch ($i, true) { I'd very much prefer a "strict switch ($i) { ... }" over a second parameter. Wha

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Ryan Pallas
On Sep 10, 2017 1:23 PM, "li...@rhsoft.net" wrote: Am 10.09.2017 um 21:16 schrieb Theodore Brown: > On Sunday, September 10, 2017 12:45 PM Rowan Collins < > rowan.coll...@gmail.com> wrote: > > Would it be possible to add an optional `$strict` parameter to switch? E.g. ``` switch

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread li...@rhsoft.net
Am 10.09.2017 um 21:25 schrieb Ryan Pallas: On Sep 10, 2017 1:23 PM, "li...@rhsoft.net " mailto:li...@rhsoft.net>> wrote: Am 10.09.2017 um 21:16 schrieb Theodore Brown: On Sunday, September 10, 2017 12:45 PM Rowan Collins mailto:rowan.coll...

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Rowan Collins
On 10/09/2017 20:16, Theodore Brown wrote: On Sunday, September 10, 2017 12:45 PM Rowan Collins wrote: >>> Would it be possible to add an optional `$strict` parameter to >>> switch? E.g. >>> ``` >>> switch ($i, true) { >> >> I'd very much prefer a "strict switch ($i) { ... }" over a second pa

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Dustin Wheeler
On Sun, Sep 10, 2017 at 4:18 PM, Rowan Collins wrote: > > The choice of "use" as the keyword was largely because it's already a > reserved word, with multiple meanings in different contexts. As well as > anonymous functions, it's the keyword for importing names from other > namespaces, and for inc

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread Rowan Collins
On 10/09/2017 20:35, li...@rhsoft.net wrote: the whole switch discussion is broken by design with " strict_types does not currently have any effect on comparisons anywhere, and nor is it likely ever to do so. It is a very specific option, not a broad set of behaviours like "use strict" in JS o

Re: [PHP-DEV] [RFC] Match expression

2017-09-10 Thread li...@rhsoft.net
Am 10.09.2017 um 22:35 schrieb Rowan Collins: On 10/09/2017 20:35, li...@rhsoft.net wrote: with " strict_types does not currently have any effect on comparisons anywhere, and nor is it likely ever to do so. It is a very specific option, not a broad set of behaviours like "use strict" in JS o

[PHP-DEV] Wiki karma request

2017-09-10 Thread Haitao Lv
Username: lvht Access requested: Wiki create Reason: Create RFC for feature of Fiber (sackful coroutine) support. Thanks. Haitao Lv -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php