Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Rob Landers
On Tue, Oct 1, 2024, at 23:02, Nick Lockheart wrote: > > > > Hey Nick, > > > > Is this actually an issue though? \Directory would be a weird thing > > to autoload. Most people tend to autoload specific namespaces. I > > think it would be weird to autoload into the global namespace. > > > > Maybe

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Nick Lockheart
On Tue, 2024-10-01 at 18:32 -0500, Larry Garfield wrote: > On Tue, Oct 1, 2024, at 4:02 PM, Nick Lockheart wrote: > > > > > Which is why anyone creating a global namespace class, especially > with a generic name like that, in 2024 is Doing PHP Wrong(tm). OK. I'm going to go back to writing fast,

Re: [PHP-DEV] Protected destructors

2024-10-01 Thread Larry Garfield
On Tue, Oct 1, 2024, at 2:06 PM, Rowan Tommins [IMSoP] wrote: > On Tue, 1 Oct 2024, at 19:29, Larry Garfield wrote: >> I would have said with() would be neat in PHP. :-) > > I have been considering for a while proposing Context Managers > [Python's with(), not to be confused with VisualBasic & Jav

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Larry Garfield
On Tue, Oct 1, 2024, at 4:02 PM, Nick Lockheart wrote: >> >> Hey Nick, >> >> Is this actually an issue though? \Directory would be a weird thing >> to autoload. Most people tend to autoload specific namespaces. I >> think it would be weird to autoload into the global namespace. >> >> Maybe I am

[PHP-DEV] [RFC] [Discussion] Add get_declared_enums() function

2024-10-01 Thread Juliette Reinders Folmer
L.S., After the earlier discussion [1] regarding this topic in August, it is our pleasure to present the RFC to add a `get_declared_enums()` function to PHP for discussion. https://wiki.php.net/rfc/get_declared_enums We look forward to your feedback and hope for a constructive discussion. S

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Nick Lockheart
> > Hey Nick, > > Is this actually an issue though? \Directory would be a weird thing > to autoload. Most people tend to autoload specific namespaces. I > think it would be weird to autoload into the global namespace. > > Maybe I am wrong, and that is why I ask. > > — Rob In a situation where

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Rob Landers
On Tue, Oct 1, 2024, at 22:21, Nick Lockheart wrote: > On Tue, 2024-10-01 at 16:36 +, Gina P. Banyard wrote: > > On Wednesday, 25 September 2024 at 10:12, Nick Lockheart > > wrote: > > > > > On Sat, 2024-09-14 at 15:33 +, Gina P. Banyard wrote: > > > I don't suppose we could call the Dire

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Nick Lockheart
On Tue, 2024-10-01 at 16:36 +, Gina P. Banyard wrote: > On Wednesday, 25 September 2024 at 10:12, Nick Lockheart > wrote: > > > On Sat, 2024-09-14 at 15:33 +, Gina P. Banyard wrote: > > I don't suppose we could call the Directory class something else, > > like > > "SPLDirectory"? > > > >

Re: [PHP-DEV] Protected destructors

2024-10-01 Thread Rowan Tommins [IMSoP]
On Tue, 1 Oct 2024, at 19:29, Larry Garfield wrote: > I would have said with() would be neat in PHP. :-) I have been considering for a while proposing Context Managers [Python's with(), not to be confused with VisualBasic & JavaScript unrelated feature with the same keyword]. My primary example

Re: [PHP-DEV] Protected destructors

2024-10-01 Thread Larry Garfield
On Tue, Oct 1, 2024, at 10:39 AM, K Sandvik wrote: >> On Oct 1, 2024, at 5:12 AM, Arnaud Le Blanc wrote: >> >> Some use-cases of destructors could be replaced with patterns like >> Python's with() [3], Java's try-with [4], or Go's defer [5]. > > defer would be neat in PHP. --Kent I would have sa

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Gina P. Banyard
On Tuesday, 24 September 2024 at 13:25, Gina P. Banyard wrote: > On Saturday, 14 September 2024 at 16:33, Gina P. Banyard intern...@gpb.moe > wrote: > > > Hello internals, > > > > I came across the Directory class while doing some code exploration of > > ext/standard. > > This class is effec

Re: [PHP-DEV] [RFC] Change Directory class to behave like an opaque object

2024-10-01 Thread Gina P. Banyard
On Wednesday, 25 September 2024 at 10:12, Nick Lockheart wrote: > On Sat, 2024-09-14 at 15:33 +, Gina P. Banyard wrote: > I don't suppose we could call the Directory class something else, like > "SPLDirectory"? > > You can't make a Directory with `new` (or at least you aren't supposed > to

Re: [PHP-DEV] Protected destructors

2024-10-01 Thread K Sandvik
> On Oct 1, 2024, at 5:12 AM, Arnaud Le Blanc wrote: > > Some use-cases of destructors could be replaced with patterns like > Python's with() [3], Java's try-with [4], or Go's defer [5]. defer would be neat in PHP. --Kent

Re: [PHP-DEV] Protected destructors

2024-10-01 Thread Arnaud Le Blanc
Hi Jonathan, > It seems the protected but not private destructors idea was already > implemented for PHP 7 (https://3v4l.org/6DFGp) but fell victim to a > regression in 7.3.15/7.4.3 and no-one noticed because it was never added > to the changelog in the first place. Apparently the engine can succ

Re: [PHP-DEV] Protected destructors

2024-10-01 Thread Arnaud Le Blanc
Hi Christoph, On Sat, Sep 28, 2024 at 4:47 PM Christoph M. Becker wrote: > > Besides closing resources and killing processes I've seen them store > > data to disk for caching, remove temp files, call callbacks/dispatch > > events, change state on other objects, dump stored errors to error_log > >