[PHP-DEV] FFI::new(), FFI::type(), FFI::cast() statically RFC is stupid implementation

2024-06-19 Thread chopins xiao
Haven't been paying attention for a while and found that FFI::new(), FFI::type(), FFI::cast()statically are marked as deprecated, which is a bad implementation. Suggesting in RFC:https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#fficast_ffinew_and_ffitype that you should r

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Rowan Tommins [IMSoP]
On 19/06/2024 09:30, Robert Landers wrote: Essentially, an int could become a float (within some limits), but a float can only become an int if it is an int itself. The same concept of a string, where "123test" couldn't become a number because "test" would be lost. Both of these are already co

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Mike Schinkel
> On Jun 19, 2024, at 2:36 PM, Ilija Tovilo wrote: > On Wed, Jun 19, 2024 at 2:34 PM Erick de Azevedo Lima > wrote: >> New expressions continue to not be supported in (static and non-static) >> property initializers and class constant initializers. The reasons for this >> are twofold: >> [snip]

Re: [PHP-DEV] [RFC] [discussion] Correctly name the rounding mode and make it an Enum

2024-06-19 Thread Claude Pache
Hi, Naming is hard, for sure. Here is my review. I find the names mostly reasonable, except Round::PositiveInfinity and Round::NegativeInfinity. I will discuss Round::PositiveInfinity. First: > I've discussed this with Saki. In that case the `HalfEven` and `HalfOdd` > modes would also need t

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Ilija Tovilo
Hi Erick On Wed, Jun 19, 2024 at 2:34 PM Erick de Azevedo Lima wrote: > > You can read the RFC here: > https://wiki.php.net/rfc/static_constructor I see that you're using zend_class_init_statics() as a hook to call __static_construct(). This makes the initialization order unpredictable, because

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Tim Düsterhus
Hi On 6/19/24 16:03, Erick de Azevedo Lima wrote: I have considered some names, actually. I just chose this one for the implementation because I tried to design it to be as close as possible to the C# implementation and they call it "static constructor". But the name can be changed to another on

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Mike Schinkel
> On Jun 19, 2024, at 8:33 AM, Erick de Azevedo Lima > wrote: > > Hello everybody. > > I found myself wanting this feature (that I first encountered when > programming in C#) for removing a workaround from a codebase I work from time > to time. > I searched int

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Mike Schinkel
> On Jun 18, 2024, at 5:04 PM, David Gebler wrote: > > On Tue, 18 Jun 2024, 17:40 Robert Landers, > wrote: > Hello internals, > > Many, many people start their files fairly religiously: > > > and I say "religiously" because from talking to people in real lif

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Robert Landers
On Wed, Jun 19, 2024 at 5:43 PM Sebastian Bergmann wrote: > > Am 19.06.2024 um 17:34 schrieb Larry Garfield: > > Also, as someone who does put every file into strict mode as a matter of > > course, and appreciates the many languages that do not even have a concept > > of non-strict mode (like Go

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Sebastian Bergmann
Am 19.06.2024 um 17:34 schrieb Larry Garfield: Also, as someone who does put every file into strict mode as a matter of course, and appreciates the many languages that do not even have a concept of non-strict mode (like Go or Rust), I really don't appreciate the backhanded comments in this thr

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Larry Garfield
On Wed, Jun 19, 2024, at 10:07 AM, Gina P. Banyard wrote: > On Tuesday, 18 June 2024 at 17:37, Robert Landers > wrote: > >> Hello internals, >> >> [...] >> >> What are your thoughts? > > As self-proclaimed leading expert on PHP type juggling. > That it is a terrible idea with no gains whatsoeve

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Larry Garfield
On Wed, Jun 19, 2024, at 7:33 AM, Erick de Azevedo Lima wrote: > Hello everybody. > > I found myself wanting this feature (that I first encountered when > programming in C#) for removing a workaround from a codebase I work > from time to time. > I searched internals and found a discussion from al

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Gina P. Banyard
On Tuesday, 18 June 2024 at 17:37, Robert Landers wrote: > Hello internals, > > [...] > > What are your thoughts? As self-proclaimed leading expert on PHP type juggling. That it is a terrible idea with no gains whatsoever. Renaming the declare statement does not improve the situation. > PS.

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Erick de Azevedo Lima
Hi, Michał. > Have you considered naming it for example shortly `function __static()` ? I have considered some names, actually. I just chose this one for the implementation because I tried to design it to be as close as possible to the C# implementation and they call it "static constructor". But

Re: [PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Michał Marcin Brzuchalski
Hi Erick, śr., 19 cze 2024 o 14:35 Erick de Azevedo Lima napisał(a): > Hello everybody. > > I found myself wanting this feature (that I first encountered when > programming in C#) for removing a workaround from a codebase I work from > time to time. > I searched internals and found a discussion

[PHP-DEV] [RFC] Static Constructor

2024-06-19 Thread Erick de Azevedo Lima
Hello everybody. I found myself wanting this feature (that I first encountered when programming in C#) for removing a workaround from a codebase I work from time to time. I searched internals and found a discussion from almost a decade ago. That discussion did not end well, mostly because of insul

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Michał Marcin Brzuchalski
Hi David, Robert, wt., 18 cze 2024 o 23:12 David Gebler napisał(a): > ... > If I were to support any change to how this feature works for PHP 9, I > think it would be providing a mechanism to enable it for all files at once, > maybe either via a .ini setting such as strict_types_default=1 or a n

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread David Gebler
On Wed, 19 Jun 2024, 09:31 Robert Landers, wrote: > > The problem isn't so much this, but in that it has become a dogma to > "have working types" and trying to explain why they do or do not > need/want it in the current context becomes a hopeless argument > because you are attacking their world-v

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Robert Landers
On Tue, Jun 18, 2024 at 11:04 PM David Gebler wrote: > > On Tue, 18 Jun 2024, 17:40 Robert Landers, wrote: >> >> Hello internals, >> >> Many, many people start their files fairly religiously: >> >> > >> and I say "religiously" because from talking to people in real life, >> reddit, workplaces, et

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Robert Landers
On Tue, Jun 18, 2024 at 10:46 PM Rowan Tommins [IMSoP] wrote: > > On 18/06/2024 17:37, Robert Landers wrote: > > One thing is clear is that "strict types" may be a bit of poor word > choice and gives people a false sense of security that it is "safe" or > "more correct" when this obviously isn't t

Re: [PHP-DEV] Renaming "strict types" to "scalar type coercion"

2024-06-19 Thread Robert Landers
On Tue, Jun 18, 2024 at 9:18 PM Claude Pache wrote: > > Hi, > > > One thing is clear is that "strict types" may be a bit of poor word > > choice and gives people a false sense of security that it is "safe" or > > "more correct" when this obviously isn't true. Thus, I'd like to > > propose, for PHP