Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Saki Takamachi
Hi Barney, Jordan, I would like to thank you all again for discussing this RFC in great detail. I believe that the specification for the `BCMath\Number` class is in very good shape due to the detailed discussions and the great amount of feedback. Now that we have been able to brush up the

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Jordan LeDoux
On Thu, Apr 4, 2024 at 2:19 PM Barney Laurance wrote: > > I don't think it will be possible to make a good Money class as a child of > this. BcNum is a read-only class, so if the constructor of BcNum is final > then the child class won't be able to take the currency as a constructor > param, and

Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type

2024-04-04 Thread Jordan LeDoux
On Thu, Apr 4, 2024 at 2:28 PM Rowan Tommins [IMSoP] wrote: > > > I haven't followed the discussion in the other thread, but I'm not sure > what the use case would be for a "fixed scale decimal" that followed > those rules. > > As mentioned before, the use case I've encountered is money >

Re: [PHP-DEV] [RFC][Concept] Data classes (a.k.a. structs)

2024-04-04 Thread Rowan Tommins [IMSoP]
On 03/04/2024 00:01, Ilija Tovilo wrote: Data classes are classes with a single additional > zend_class_entry.ce_flags flag. So unless customized, they behave as > classes. This way, we have the option to tweak any behavior we would > like, but we don't need to. > > Of course, this will still

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Mark Trapp
On Thu, Apr 4, 2024 at 2:16 PM Bilge wrote: > > On 04/04/2024 16:57, Tim Düsterhus wrote: >> I think it would be reasonable to consider deprecating passing extra >> arguments to a non-variadic function. > > This seems like the only reasonable thing to do, to me. If this were the > case, there

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Ilija Tovilo
On Thu, Apr 4, 2024 at 5:58 PM Tim Düsterhus wrote: > > On 4/4/24 16:36, Pablo Rauzy wrote: > > I strongly agree in theory, but this could break existing code, and > > moreover such a proposal was already rejected: > > https://wiki.php.net/rfc/strict_argcount > > The RFC is 9 years old by now. My

Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type

2024-04-04 Thread Rowan Tommins [IMSoP]
On 04/04/2024 02:29, Jordan LeDoux wrote: But when it comes to fixed-precision values, it should follow rules very similar to those we discussed in the BCMath thread: - Addition and subtraction should return a value that is the largest scale/precision of any operands in the calculation. -

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Barney Laurance
On 04/04/2024 22:10, Jordan LeDoux wrote: On Thu, Apr 4, 2024 at 1:59 PM Barney Laurance wrote: Hi again, On 27/03/2024 00:40, Saki Takamachi wrote: Do we also need `toFloat` and `toInt` functions? Seems like using explicit functions will be safer than casting. For

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Barney Laurance
On 04/04/2024 01:54, Jordan LeDoux wrote: On Tue, Apr 2, 2024 at 5:43 PM Saki Takamachi wrote: If make a class final, users will not be able to add arbitrary methods, so I think making each method final. Although it is possible to completely separate behavior between method and

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Bilge
On 04/04/2024 16:57, Tim Düsterhus wrote: I think it would be reasonable to consider deprecating passing extra arguments to a non-variadic function. This seems like the only reasonable thing to do, to me. If this were the case, there should be no need for any new syntax, since we could simply

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Jordan LeDoux
On Thu, Apr 4, 2024 at 1:59 PM Barney Laurance wrote: > Hi again, > > On 27/03/2024 00:40, Saki Takamachi wrote: > > Do we also need `toFloat` and `toInt` functions? Seems like using explicit > functions will be safer than casting. > > For toInt I'd expect an exception if the value is outside

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Pablo Rauzy
Le 04/04/2024 à 17:57, Tim Düsterhus a écrit : Hi On 4/4/24 16:36, Pablo Rauzy wrote: I strongly agree in theory, but this could break existing code, and moreover such a proposal was already rejected: https://wiki.php.net/rfc/strict_argcount The RFC is 9 years old by now. My gut feeling is

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Barney Laurance
Hi again, On 27/03/2024 00:40, Saki Takamachi wrote: Do we also need `toFloat` and `toInt` functions? Seems like using explicit functions will be safer than casting. For toInt I'd expect an exception if the value is outside the range of possible ints. For toFloat it might be nice to have a

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Larry Garfield
On Thu, Apr 4, 2024, at 3:49 PM, Tim Düsterhus wrote: > Hi > > On 4/4/24 17:40, Vinicius Dias wrote: >>> I like this concept, but instead of introducing a new syntax, have you >>> considered leveraging attributes in the same way that PHP 8.3 >>> introduced #[Override]? >>> >>> #[Nonvariadic] >>>

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Tim Düsterhus
Hi On 4/4/24 16:36, Pablo Rauzy wrote: I strongly agree in theory, but this could break existing code, and moreover such a proposal was already rejected: https://wiki.php.net/rfc/strict_argcount The RFC is 9 years old by now. My gut feeling is be that using an actual variadic parameter for

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Tim Düsterhus
Hi On 4/4/24 17:40, Vinicius Dias wrote: I like this concept, but instead of introducing a new syntax, have you considered leveraging attributes in the same way that PHP 8.3 introduced #[Override]? #[Nonvariadic] function foo () {} foo(42); // warning: foo() expects exactly 0 arguments, 1

Re: [PHP-DEV] [RFC] [Discussion] Deprecate GET/POST sessions

2024-04-04 Thread Claude Pache
> Le 4 avr. 2024 à 01:08, Kamil Tekiela a écrit : > > If there are no more comments, I would like to put this RFC to vote in > the next two days. Hi, 1. In session_start(), it is possible to override ini settings like that: ```php session_start([ 'use_cookies' => '1', 'use_only_cookies'

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Vinicius Dias
> I like this concept, but instead of introducing a new syntax, have you > considered leveraging attributes in the same way that PHP 8.3 > introduced #[Override]? > > #[Nonvariadic] > function foo () {} > foo(42); // warning: foo() expects exactly 0 arguments, 1 given > > I think the intent would

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Claude Pache
> Le 4 avr. 2024 à 15:10, Kamil Tekiela a écrit : > > Why is passing extra arguments a problem at all? In a parallel perfect and boring world, it is not a problem. In our world, disallowing extra arguments have two advantages: * catching bugs; * allowing to add new optional parameters to an

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Pablo Rauzy
Le 04/04/2024 à 16:29, Claude Pache a écrit : Le 4 avr. 2024 à 15:03, Mark Trapp a écrit : On Thu, Apr 4, 2024 at 5:43 AM Pablo Rauzy wrote: I like this concept, but instead of introducing a new syntax, have you considered leveraging attributes in the same way that PHP 8.3 introduced

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Claude Pache
> Le 4 avr. 2024 à 15:03, Mark Trapp a écrit : > > On Thu, Apr 4, 2024 at 5:43 AM Pablo Rauzy wrote: > > I like this concept, but instead of introducing a new syntax, have you > considered leveraging attributes in the same way that PHP 8.3 > introduced #[Override]? > > #[Nonvariadic] >

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Pablo Rauzy
Le 04/04/2024 à 15:03, Mark Trapp a écrit : On Thu, Apr 4, 2024 at 5:43 AM Pablo Rauzy wrote: Hello all, First, I'm new here, so let me start by warmly thanking everyone involved in PHP development. I've started programming 22 years using it as my first programming language, and still enjoy

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Pablo Rauzy
Hello Kamil, Le 04/04/2024 à 15:10, Kamil Tekiela a écrit : Interesting proposal, but immediately I have two questions: 1. Why is passing extra arguments a problem at all? Is generating a warning a good idea? If you would like to introduce a new syntax to enforce non-variadic functions,

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Kamil Tekiela
Hi Pablo, Interesting proposal, but immediately I have two questions: 1. Why is passing extra arguments a problem at all? Is generating a warning a good idea? If you would like to introduce a new syntax to enforce non-variadic functions, shouldn't it be a runtime error then? Generating a warning

Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Mark Trapp
On Thu, Apr 4, 2024 at 5:43 AM Pablo Rauzy wrote: > > Hello all, > > First, I'm new here, so let me start by warmly thanking everyone > involved in PHP development. I've started programming 22 years using it > as my first programming language, and still enjoy using it a lot :). > > I've read the

[PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions

2024-04-04 Thread Pablo Rauzy
Hello all, First, I'm new here, so let me start by warmly thanking everyone involved in PHP development. I've started programming 22 years using it as my first programming language, and still enjoy using it a lot :). I've read the rfc:howto and the first step is to get feedback from this

Re: [PHP-DEV] [RFC][Concept] Data classes (a.k.a. structs)

2024-04-04 Thread Kévin Dunglas
Data classes will be a very useful addition to "API Platform". API Platform is a "resource-oriented" framework that strongly encourages the use of "data-only" classes: we use PHP classes both as a specification language to document the public shape of web APIs (like an OpenAPI specification, but

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Saki Takamachi
Hi Chris, > Looks very promising! > > The default value for rounding is PHP_ROUND_TOWARD_ZERO. Is this because it > is the same as the BCMath functions for consistency only or do you expect > this to be the most used rounding mode? > I didn't find any discussion about this choice, sorry if I

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Christian Schneider
Am 04.04.2024 um 08:29 schrieb Saki Takamachi : > I added some examples, corrected incorrect explanations, etc. Now that the > specifications have been fairly finalized and the RFC has been clarified, I > would like everyone to check it out again. > >

Re: [PHP-DEV] [RFC] [Discussion] Support object type in BCMath

2024-04-04 Thread Saki Takamachi
Hi, I added some examples, corrected incorrect explanations, etc. Now that the specifications have been fairly finalized and the RFC has been clarified, I would like everyone to check it out again. https://wiki.php.net/rfc/support_object_type_in_bcmath Regards. Saki