Re: [PHP-DEV] [RFC] Exception type hint

2022-06-30 Thread Michał Marcin Brzuchalski
Hi Jeffrey, czw., 30 cze 2022 o 17:41 Jeffrey Dafoe napisał(a): > > -Original Message- > > From: Larry Garfield > > Sent: Wednesday, June 29, 2022 12:39 PM > > To: php internals > > Subject: Re: [PHP-DEV] [RFC] Exception type hint > > > > On Wed, Jun 29, 2022, at 10:42 AM, Guilliam Xav

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-30 Thread Levi Morrison via internals
On Thu, Jun 30, 2022 at 10:48 AM Pierrick Charron wrote: > > Hi all, > > > > - The new CurlUrl class should probably be immutable from the start. It > > was my biggest mistake not to do that with DateTime. > > > > > After thinking about it and some discussions, I followed Derick's > recommendation

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Rowan Tommins
On 30/06/2022 18:37, Arnaud Le Blanc wrote: On jeudi 30 juin 2022 18:29:44 CEST Guilliam Xavier wrote: Ah? Sorry, I had interpreted https://github.com/php/php-src/pull/8330/files#diff-85701127596aca0e597bd796 1b5d59cdde4f6bb3e2a109a22be859ab7568b4d2R7318-R7320 as "capture the *minimal* set of va

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Arnaud Le Blanc
On jeudi 30 juin 2022 18:29:44 CEST Guilliam Xavier wrote: > Ah? Sorry, I had interpreted > https://github.com/php/php-src/pull/8330/files#diff-85701127596aca0e597bd796 > 1b5d59cdde4f6bb3e2a109a22be859ab7568b4d2R7318-R7320 as "capture the > *minimal* set of variables for *both* arrow functions and

Re: [PHP-DEV] [RFC] [Under Discussion] New Curl URL API

2022-06-30 Thread Pierrick Charron
Hi all, > - The new CurlUrl class should probably be immutable from the start. It > was my biggest mistake not to do that with DateTime. > > After thinking about it and some discussions, I followed Derick's recommendation and therefore changed the RFC to make the CurlUrl class immutable. All the

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Guilliam Xavier
On Thu, Jun 30, 2022 at 5:57 PM Arnaud Le Blanc wrote: > > Hi, > > On jeudi 30 juin 2022 16:18:44 CEST Robert Landers wrote: > > Are > > optimizations going to be applied to single-line arrow functions (I > > didn't see that in the RFC, but I admittedly didn't look that hard and > > I vaguely reme

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Robert Landers
On Thu, Jun 30, 2022 at 5:47 PM Guilliam Xavier wrote: > > On Thu, Jun 30, 2022 at 3:26 PM Dan Ackroyd wrote: > > > > Hi Rowan, > > > > Rowan wrote: > > > For that to work, it would require the variable to be captured by > > > reference, not value. > > > ... > > > The only way for it to work woul

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Arnaud Le Blanc
Hi, On jeudi 30 juin 2022 16:18:44 CEST Robert Landers wrote: > Are > optimizations going to be applied to single-line arrow functions (I > didn't see that in the RFC, but I admittedly didn't look that hard and > I vaguely remember reading something about it in one of these > threads)? If so, it w

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Guilliam Xavier
On Thu, Jun 30, 2022 at 3:26 PM Dan Ackroyd wrote: > > Hi Rowan, > > Rowan wrote: > > For that to work, it would require the variable to be captured by > > reference, not value. > > ... > > The only way for it to work would be using capture by reference (not > > supported by the proposed short syn

RE: [PHP-DEV] [RFC] Exception type hint

2022-06-30 Thread Jeffrey Dafoe
> -Original Message- > From: Larry Garfield > Sent: Wednesday, June 29, 2022 12:39 PM > To: php internals > Subject: Re: [PHP-DEV] [RFC] Exception type hint > > On Wed, Jun 29, 2022, at 10:42 AM, Guilliam Xavier wrote: > > Hi (note: your message was flagged as spam), > > > >> https://git

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Rowan Tommins
On 30/06/2022 14:25, Dan Ackroyd wrote: With automatic capturing of variables, for the code example I gave the user would want the variable to be captured, and to them it looks like it should be, but because of an optimization it is not. Please look again at the detailed explanation I gave, an

Re: [PHP-DEV] [RFC] Exception type hint

2022-06-30 Thread Larry Garfield
On Thu, Jun 30, 2022, at 8:35 AM, Dan Ackroyd wrote: > Antoine wrote: >> It could be beneficial for the whole ecosystem to have as well exceptions >> type hint. > > Here are my short notes on the topic. > https://github.com/Danack/RfcCodex/blob/master/throws_declaration.md > > tl:dr someone probab

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Robert Landers
On Thu, Jun 30, 2022 at 3:26 PM Dan Ackroyd wrote: > > Hi Rowan, > > Rowan wrote: > > For that to work, it would require the variable to be captured by > > reference, not value. > > ... > > The only way for it to work would be using capture by reference (not > > supported by the proposed short syn

Re: [PHP-DEV] [RFC] Exception type hint

2022-06-30 Thread Dan Ackroyd
Antoine wrote: > It could be beneficial for the whole ecosystem to have as well exceptions > type hint. Here are my short notes on the topic. https://github.com/Danack/RfcCodex/blob/master/throws_declaration.md tl:dr someone probably needs to come up with a strong reason for why it would be a go

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Dan Ackroyd
Hi Rowan, Rowan wrote: > For that to work, it would require the variable to be captured by > reference, not value. > ... > The only way for it to work would be using capture by reference (not > supported by the proposed short syntax): I wrote about this before. Some of the words in the RFC are, i

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Rowan Tommins
On 30/06/2022 11:29, Arnaud Le Blanc wrote: I feel that the RAII pattern aka SBRM / Scope-Bound Resource Management is not relevant in PHP context, and I don't believe that it's commonly used in PHP or in garbage collected language. I've used a simple version of the pattern effectively to imp

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Arnaud Le Blanc
Hi, On jeudi 30 juin 2022 00:31:44 CEST Dan Ackroyd wrote: > On Wed, 29 Jun 2022 at 18:30, Larry Garfield wrote: > > The conversation has died down, so we'll be opening the vote for this > > tomorrow. > I think I've just thought of a problem with the optimization bit of > 'not capturing variables

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Guilliam Xavier
On Thu, Jun 30, 2022 at 11:20 AM Robert Landers wrote: > > On Thu, Jun 30, 2022 at 10:19 AM Rowan Tommins > wrote: > > > > On 29/06/2022 23:31, Dan Ackroyd wrote: > > > Imagine some code that looks like this: > > > > > > // Acquire some resource e.g. an exclusive lock. > > > $some_resource = acq

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Rowan Tommins
On 30/06/2022 10:20, Robert Landers wrote: I think their suggested code would work (at least currently in PHP) by the simple fact they would increase the reference count on that object/resource until they set it as null. However, with the "optimization," the reference count will never be incremen

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Robert Landers
On Thu, Jun 30, 2022 at 10:19 AM Rowan Tommins wrote: > > On 29/06/2022 23:31, Dan Ackroyd wrote: > > Imagine some code that looks like this: > > > > // Acquire some resource e.g. an exclusive lock. > > $some_resource = acquire_some_resource(); > > > > $fn = fn () { > > // Free that resource

Re: [PHP-DEV] [RFC] Short Closures 2, aka auto-capture take 3

2022-06-30 Thread Rowan Tommins
On 29/06/2022 23:31, Dan Ackroyd wrote: Imagine some code that looks like this: // Acquire some resource e.g. an exclusive lock. $some_resource = acquire_some_resource(); $fn = fn () { // Free that resource $some_resource = null; } // do some stuff that assumes the exclusive // lock